LaunchDarkly Dotnet Client SDK
Search Results for

    Show / Hide Table of Contents

    Interface IEventSource

    This interface defines the public members of EventSource.

    Namespace: LaunchDarkly.EventSource
    Assembly: LaunchDarkly.EventSource.dll
    Syntax
    public interface IEventSource

    Properties

    ReadyState

    Gets the state of the EventSource connection.

    Declaration
    ReadyState ReadyState { get; }
    Property Value
    Type Description
    ReadyState

    Methods

    Close()

    Closes the connection to the SSE server. The EventSource cannot be reopened after this.

    Declaration
    void Close()

    Restart(bool)

    Triggers the same "close and retry" behavior as if an error had been encountered on the stream.

    Declaration
    void Restart(bool resetBackoffDelay)
    Parameters
    Type Name Description
    bool resetBackoffDelay

    true if the delay before reconnection should be reset to the lowest level (InitialRetryDelay(TimeSpan)); false if it should increase according to the usual exponential backoff logic

    Remarks

    If the stream is currently active, this closes the connection, waits for some amount of time as determined by the usual backoff behavior (and resetBackoffDelay), and then attempts to reconnect. If the stream is not yet connected, is already waiting to reconnect, or has been permanently shut down, this has no effect.

    The method returns immediately without waiting for the reconnection to happen. You will receive Closed and Opened events when it does happen (or an Error event if the new connection attempt fails).

    StartAsync()

    Initiates a connection to the SSE server and begins parsing events.

    Declaration
    Task StartAsync()
    Returns
    Type Description
    Task

    a Task that will be completed only when the EventSource is closed

    Exceptions
    Type Condition
    InvalidOperationException

    if the method was called again after the stream connection was already active

    Events

    Closed

    Occurs when the connection to the EventSource API has been closed.

    Declaration
    event EventHandler<StateChangedEventArgs> Closed
    Event Type
    Type Description
    EventHandler<StateChangedEventArgs>

    CommentReceived

    Occurs when a comment has been received from the EventSource API.

    Declaration
    event EventHandler<CommentReceivedEventArgs> CommentReceived
    Event Type
    Type Description
    EventHandler<CommentReceivedEventArgs>

    Error

    Occurs when an error has happened when the EventSource is open and processing Server Sent Events.

    Declaration
    event EventHandler<ExceptionEventArgs> Error
    Event Type
    Type Description
    EventHandler<ExceptionEventArgs>

    MessageReceived

    Occurs when a Server Sent Event from the EventSource API has been received.

    Declaration
    event EventHandler<MessageReceivedEventArgs> MessageReceived
    Event Type
    Type Description
    EventHandler<MessageReceivedEventArgs>

    Opened

    Occurs when the connection to the EventSource API has been opened.

    Declaration
    event EventHandler<StateChangedEventArgs> Opened
    Event Type
    Type Description
    EventHandler<StateChangedEventArgs>
    In this article
    Back to top Generated by DocFX