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 RealtimePresenceCallbacks 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 RealtimePresenceCallbacks object for this channel.
Optional
callback: StandardCallback<null | ChannelStateChange>
A function which will be called upon completion of the operation. If the operation succeeded and the channel became attached, then the function will be called with a ChannelStateChange object. If the channel was already attached the function will be called with null
. If it failed, the function will be called with information about the error.
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.
Optional
callback: errorCallback
A function which will be called upon completion of the operation. If the operation succeeded, then the function will be called with null
. If it failed, the function will be called with information about the error.
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.
Optional
params: RealtimeHistoryParams
A set of parameters which are used to specify which presence members should be retrieved.
Optional
callback: paginatedResultCallback<Message>
A function which, upon success, will be called with a PaginatedResult object containing an array of Message objects. Upon failure, the function will be called with information about the error.
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.
Optional
callback: paginatedResultCallback<Message>
A function which, upon success, will be called with a PaginatedResult object containing an array of Message objects. Upon failure, the function will be called with information about the error.
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.
The event name.
The message payload.
Optional
callback: errorCallback
A function which will be called upon completion of the operation. If the operation succeeded, then the function will be called with null
. If it failed, the function will be called with information about the error.
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.
An array of Message objects.
Optional
callback: errorCallback
A function which will be called upon completion of the operation. If the operation succeeded, then the function will be called with null
. If it failed, the function will be called with information about the error.
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 Message object.
Optional
callback: errorCallback
A function which will be called upon completion of the operation. If the operation succeeded, then the function will be called with null
. If it failed, the function will be called with information about the error.
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.
The event name.
The message payload.
Optional
callback: errorCallback
A function which will be called upon completion of the operation. If the operation succeeded, then the function will be called with null
. If it failed, the function will be called with information about the error.
Sets the ChannelOptions for the channel.
A ChannelOptions object.
Optional
callback: errorCallback
A function which will be called upon completion of the operation. If the operation succeeded, then the function will be called with null
. If it failed, the function will be called with information about the error.
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.
The event name.
Optional
listener: messageCallback<Message>
An event listener function.
Optional
callbackWhenAttached: StandardCallback<null | ChannelStateChange>
A function which will be called upon completion of the channel attach()
operation. If the operation succeeded and the channel became attached, then the function will be called with a ChannelStateChange object. If the channel was already attached the function will be called with null
. If it failed, the function will be called with information about the error.
Registers a listener for messages on this channel for multiple event name values.
An array of event names.
Optional
listener: messageCallback<Message>
An event listener function.
Optional
callbackWhenAttached: StandardCallback<null | ChannelStateChange>
A function which will be called upon completion of the channel attach()
operation. If the operation succeeded and the channel became attached, then the function will be called with a ChannelStateChange object. If the channel was already attached the function will be called with null
. If it failed, the function will be called with information about the error.
Registers a listener for messages on this channel that match the supplied filter.
Optional
listener: messageCallback<Message>
An event listener function.
Optional
callbackWhenAttached: StandardCallback<null | ChannelStateChange>
A function which will be called upon completion of the channel attach()
operation. If the operation succeeded and the channel became attached, then the function will be called with a ChannelStateChange object. If the channel was already attached the function will be called with null
. If it failed, the function will be called with information about the error.
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.
An event listener function.
Optional
callbackWhenAttached: StandardCallback<ChannelStateChange>
A function which will be called upon completion of the channel attach()
operation. If the operation succeeded and the channel became attached, then the function will be called with a ChannelStateChange object. If the channel was already attached the function will be called with null
. If it failed, the function will be called with information about the error.
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.
Calls the supplied function when the channel reaches the specified ChannelState. If the channel is already in the specified state, the callback is called immediately.
The state which should be reached.
A function which will be called when the channel has reached the specified ChannelState with a ChannelStateChange object as the first argument.
Generated using TypeDoc
Enables messages to be published and subscribed to. Also enables historic messages to be retrieved and provides access to the RealtimePresenceCallbacks object of a channel.