An ErrorInfo object describing the last error which occurred on the channel, if any.
An array of ChannelMode objects.
Readonly
name
The channel name.
Optional channel parameters that configure the behavior of the channel.
A RealtimePresencePromise object.
Readonly
state
The current ChannelState of the channel.
Attach to this channel ensuring the channel is created in the Ably system and all messages published on the channel are received by any channel listeners registered using subscribe()
. Any resulting channel state change will be emitted to any listeners registered using the on()
or once()
methods. As a convenience, attach()
is called implicitly if subscribe()
for the channel is called, or enter()
or subscribe()
are called on the RealtimePresencePromise object for this channel.
A promise which, upon success, if the channel became attached will be fulfilled with a ChannelStateChange object. If the channel was already attached the promise will be fulfilled with null
. Upon failure, the promise will be rejected with an ErrorInfo object.
Detach from this channel. Any resulting channel state change is emitted to any listeners registered using the on()
or once()
methods. Once all clients globally have detached from the channel, the channel will be released in the Ably service within two minutes.
A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.
Retrieves a PaginatedResult object, containing an array of historical Message objects for the channel. If the channel is configured to persist messages, then messages can be retrieved from history for up to 72 hours in the past. If not, messages can only be retrieved from history for up to two minutes in the past.
A promise which, upon success, will be fulfilled with a PaginatedResult object containing an array of Message objects. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.
Optional
params: RealtimeHistoryParams
A set of parameters which are used to specify which presence members should be retrieved.
Returns the listeners for a specified EventType
.
Optional
eventName: ChannelEvent
The event name to retrieve the listeners for.
Removes all registrations that match both the specified listener and the specified event.
The named event.
The event listener.
Deregisters the specified listener. Removes all registrations matching the given listener, regardless of whether they are associated with an event or not.
The event listener.
Deregisters all registrations, for all events and listeners.
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.
The named event to listen for.
The event listener.
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.
The named events to listen for.
The event listener.
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.
The event listener.
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.
The named event to listen for.
The event listener.
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.
The event listener.
Returns a promise which resolves upon the first occurrence of a single named event specified as the Event
argument.
A promise which resolves upon the first occurrence of the named event.
The named event to listen for.
Returns a promise which resolves upon the first occurrence of an event.
A promise which resolves upon the first occurrence of an event.
Publishes a single message to the channel with the given event name and payload. When publish is called with this client library, it won't attempt to implicitly attach to the channel, so long as transient publishing is available in the library. Otherwise, the client will implicitly attach.
A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.
The event name.
The message payload.
Publishes an array of messages to the channel. When publish is called with this client library, it won't attempt to implicitly attach to the channel.
A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.
An array of Message objects.
Publish a message to the channel. When publish is called with this client library, it won't attempt to implicitly attach to the channel.
A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.
A Message object.
Sets the ChannelOptions for the channel.
A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.
A ChannelOptions object.
Registers a listener for messages with a given event name on this channel. The caller supplies a listener function, which is called each time one or more matching messages arrives on the channel.
A promise which, upon successful attachment to the channel, will be fulfilled with a ChannelStateChange object. If the channel was already attached the promise will be resolved with null
. Upon failure, the promise will be rejected with an ErrorInfo object.
The event name.
Optional
listener: messageCallback<Message>
An event listener function.
Registers a listener for messages on this channel for multiple event name values.
A promise which, upon successful attachment to the channel, will be fulfilled with a ChannelStateChange object. If the channel was already attached the promise will be resolved with null
. Upon failure, the promise will be rejected with an ErrorInfo object.
An array of event names.
Optional
listener: messageCallback<Message>
An event listener function.
Registers a listener for messages on this channel that match the supplied filter.
A promise which, upon successful attachment to the channel, will be fulfilled with a ChannelStateChange object. If the channel was already attached the promise will be resolved with null
. Upon failure, the promise will be rejected with an ErrorInfo object.
Optional
listener: messageCallback<Message>
An event listener function.
Registers a listener for messages on this channel. The caller supplies a listener function, which is called each time one or more messages arrives on the channel.
A promise which, upon successful attachment to the channel, will be fulfilled with a ChannelStateChange object. If the channel was already attached the promise will be resolved with null
. Upon failure, the promise will be rejected with an ErrorInfo object.
An event listener function.
Deregisters the given listener for the specified event name. This removes an earlier event-specific subscription.
The event name.
An event listener function.
Deregisters the given listener from all event names in the array.
An array of event names.
An event listener function.
Deregisters all listeners for the given event name.
The event name.
Deregisters all listeners for all event names in the array.
An array of event names.
Deregisters all listeners to messages on this channel that match the supplied filter.
Optional
listener: messageCallback<Message>
An event listener function.
Deregisters the given listener (for any/all event names). This removes an earlier subscription.
An event listener function.
Deregisters all listeners to messages on this channel. This removes all earlier subscriptions.
Returns a promise which is resolved when the channel reaches the specified ChannelState. If the channel is already in the specified state, the promise is resolved immediately.
The state which should be reached.
Generated using TypeDoc
Enables messages to be published and subscribed to. Also enables historic messages to be retrieved and provides access to the RealtimePresencePromise object of a channel.