The ConnectionBase class acts as a base class for the ChannelCallbacks and ChannelPromise classes.

Hierarchy

Constructors

Properties

errorReason: Types.ErrorInfo

An ErrorInfo object describing the last error received if a connection failure occurs.

id?: string

A unique public identifier for this connection, used to identify this member.

key?: string

A unique private connection key used to recover or resume a connection, assigned by Ably. When recovering a connection explicitly, the recoveryKey is used in the recover client options as it contains both the key and the last message serial. This private connection key can also be used by other REST clients to publish on behalf of this client. See the publishing over REST on behalf of a realtime client docs for more info.

recoveryKey: null | string

The recovery key string can be used by another client to recover this connection's state in the recover client options property. See connection state recover options for more information.

serial: number

The serial number of the last message to be received on this connection, used automatically by the library when recovering or resuming a connection. When recovering a connection explicitly, the recoveryKey is used in the recover client options as it contains both the key and the last message serial.

The current ConnectionState of the connection.

Methods

  • Causes the connection to close, entering the CLOSING state. Once closed, the library does not attempt to re-establish the connection without an explicit call to connect().

    Returns void

  • Explicitly calling connect() is unnecessary unless the autoConnect attribute of the ClientOptions object is false. Unless already connected or connecting, this method causes the connection to open, entering the CONNECTING state.

    Returns void

  • Registers the provided listener for the specified event. If on() is called more than once with the same listener and event, the listener is added multiple times to its listener registry. Therefore, as an example, assuming the same listener is registered twice using on(), and an event is emitted once, the listener would be invoked twice.

    Parameters

    Returns void

  • Registers the provided listener for the specified events. If on() is called more than once with the same listener and event, the listener is added multiple times to its listener registry. Therefore, as an example, assuming the same listener is registered twice using on(), and an event is emitted once, the listener would be invoked twice.

    Parameters

    Returns void

  • Registers the provided listener all events. If on() is called more than once with the same listener and event, the listener is added multiple times to its listener registry. Therefore, as an example, assuming the same listener is registered twice using on(), and an event is emitted once, the listener would be invoked twice.

    Parameters

    Returns void

  • Registers the provided listener for the first occurrence of a single named event specified as the Event argument. If once is called more than once with the same listener, the listener is added multiple times to its listener registry. Therefore, as an example, assuming the same listener is registered twice using once, and an event is emitted once, the listener would be invoked twice. However, all subsequent events emitted would not invoke the listener as once ensures that each registration is only invoked once.

    Parameters

    Returns void

  • Registers the provided listener for the first event that is emitted. If once() is called more than once with the same listener, the listener is added multiple times to its listener registry. Therefore, as an example, assuming the same listener is registered twice using once(), and an event is emitted once, the listener would be invoked twice. However, all subsequent events emitted would not invoke the listener as once() ensures that each registration is only invoked once.

    Parameters

    Returns void

  • Returns a promise which resolves upon the first occurrence of a single named event specified as the Event argument.

    Returns

    A promise which resolves upon the first occurrence of the named event.

    Parameters

    Returns Promise<ConnectionStateChange>

  • Returns a promise which resolves upon the first occurrence of an event.

    Returns

    A promise which resolves upon the first occurrence of an event.

    Returns Promise<ConnectionStateChange>

Generated using TypeDoc