You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Indicates whether the presence set synchronization between Ably and the clients on the channel has been completed. Set to `true` when the sync is complete.
2158
+
* Indicates whether the presence set synchronization between Ably and the clients on the channel has been completed. Set to `true` when the sync is complete, and back to `false` whenever a new sync starts (typically after a (re)attach). The value is also `true` after the local presence set is cleared (when the channel becomes detached or failed, or attaches without the server reporting any presence members), so it indicates only that no sync is in progress (though it is initially `false`, before any sync has started), not that the channel is attached or that a sync ever ran. To wait for an in-progress sync, call {@link RealtimePresence.get | `get()`}, which by default resolves only once the sync completes.
* Deregisters a specific listener that is registered to receive {@link PresenceMessage} on the channel for a given {@link PresenceAction}.
2164
+
* Deregisters a specific listener that is registered to receive {@link PresenceMessage} on the channel for a given {@link PresenceAction}. This only removes the local listener; it does not detach the channel or remove this client from the presence set (use {@link RealtimePresence.leave | `leave()`} for that), and presence events may continue to arrive for any other registered listeners.
2163
2165
*
2164
2166
* @param presence - A specific {@link PresenceAction} to deregister the listener for.
* Deregisters a specific listener that is registered to receive {@link PresenceMessage} on the channel for a given array of {@link PresenceAction} objects.
2176
+
* Deregisters a specific listener that is registered to receive {@link PresenceMessage} on the channel for a given array of {@link PresenceAction} objects. This only removes the local listener and does not detach the channel.
2170
2177
*
2171
2178
* @param presence - An array of {@link PresenceAction} objects to deregister the listener for.
* Deregisters any listener that is registered to receive {@link PresenceMessage} on the channel for a specific {@link PresenceAction}
2184
+
* Deregisters any listener that is registered to receive {@link PresenceMessage} on the channel for a specific {@link PresenceAction}. This only removes the local listeners and does not detach the channel.
2177
2185
*
2178
2186
* @param presence - A specific {@link PresenceAction} to deregister the listeners for.
* Deregisters any listener that is registered to receive {@link PresenceMessage} on the channel for an array of {@link PresenceAction} objects
2191
+
* Deregisters any listener that is registered to receive {@link PresenceMessage} on the channel for an array of {@link PresenceAction} objects. This only removes the local listeners and does not detach the channel.
2183
2192
*
2184
2193
* @param presence - An array of {@link PresenceAction} objects to deregister the listeners for.
* Deregisters a specific listener that is registered to receive {@link PresenceMessage} on the channel.
2198
+
* Deregisters a specific listener that is registered to receive {@link PresenceMessage} on the channel. This only removes the local listener and does not detach the channel.
* Deregisters all listeners currently receiving {@link PresenceMessage} for the channel.
2205
+
* Deregisters all listeners currently receiving {@link PresenceMessage} for the channel. This only removes the local listeners and does not detach the channel or remove this client from the presence set, so the channel stays attached and an entered client remains present.
* Retrieves the current members present on the channel and the metadata for each member, such as their {@link PresenceAction} and ID. Returns an array of {@linkPresenceMessage} objects.
2212
+
* Retrieves the current members present on the channel and the metadata for each member, such as their {@link PresenceAction} and ID. Implicitly attaches the channel if it is not already attached. Requires the `presence_subscribe` mode (granted by default unless {@link ChannelOptions.modes} excludes it); without it the call resolves with an empty array rather than rejecting (or it rejects with a hinted {@linkErrorInfo} when {@link ClientOptions.strictMode} is enabled).
2200
2213
*
2201
2214
* @param params - A set of parameters which are used to specify which presence members should be retrieved.
2202
2215
* @returns A promise which, upon success, will be fulfilled with an array of {@link PresenceMessage} objects. Upon failure, the promise will be rejected with an {@link ErrorInfo} object which explains the error.
* Retrieves a {@link PaginatedResult} object, containing an array of historical {@link PresenceMessage} objects for the channel. If the channel is configured to persist messages, then presence messages can be retrieved from history for up to 72 hours in the past. If not, presence messages can only be retrieved from history for up to two minutes in the past.
2238
+
* Retrieves a {@link PaginatedResult} object, containing an array of historical {@link PresenceMessage} objects for the channel. Presence messages are retrievable for up to 72 hours in the past when message persistence is enabled for the channel by a channel rule; without it, only presence messages from the last two minutes, the service's default retention, are returned.
2221
2239
*
2222
2240
* @param params - A set of parameters which are used to specify which presence messages should be retrieved.
2223
2241
* @returns A promise which, upon success, will be fulfilled with a {@link PaginatedResult} object containing an array of {@link PresenceMessage} objects. Upon failure, the promise will be rejected with an {@link ErrorInfo} object which explains the error.
2242
+
* @example
2243
+
* ```ts
2244
+
* const result = await channel.presence.history();
* Registers a listener that is called each time a {@link PresenceMessage} matching a given {@link PresenceAction}, or an action within an array of {@link PresenceAction | `PresenceAction`s}, is received on the channel, such as a new member entering the presence set.
2265
+
* Registers a listener that is called each time a {@link PresenceMessage} matching a given {@link PresenceAction}, or an action within an array of {@link PresenceAction | `PresenceAction`s}, is received on the channel, such as a new member entering the presence set. Implicitly attaches the channel unless {@link ChannelOptions.attachOnSubscribe} is `false`. Requires the `presence_subscribe` mode (granted by default unless {@link ChannelOptions.modes} excludes it); if the channel attaches without it the server never delivers presence events, so the listener silently never fires: the call still resolves and nothing is logged.
2242
2266
*
2243
2267
* @param action - A {@link PresenceAction} or an array of {@link PresenceAction | `PresenceAction`s} to register the listener for.
2244
2268
* @param listener - An event listener function.
2245
-
* @returns A promise which resolves upon success of the channel {@link RealtimeChannel.attach | `attach()`} operation and rejects with an {@link ErrorInfo} object upon its failure.
2269
+
* @returns A promise which resolves upon success of the channel {@link RealtimeChannel.attach | `attach()`} operation and rejects with an {@link ErrorInfo} object upon its failure. When {@link ChannelOptions.attachOnSubscribe} is `false`, no attach is performed.
* Registers a listener that is called each time a {@link PresenceMessage} is received on the channel, such as a new member entering the presence set.
2278
+
* Registers a listener that is called each time a {@link PresenceMessage} is received on the channel, such as a new member entering the presence set. Implicitly attaches the channel unless {@link ChannelOptions.attachOnSubscribe} is `false`. Requires the `presence_subscribe` mode (granted by default unless {@link ChannelOptions.modes} excludes it); if the channel attaches without it the server never delivers presence events, so the listener silently never fires: the call still resolves and nothing is logged.
2250
2279
*
2251
2280
* @param listener - An event listener function.
2252
-
* @returns A promise which resolves upon success of the channel {@link RealtimeChannel.attach | `attach()`} operation and rejects with an {@link ErrorInfo} object upon its failure.
2281
+
* @returns A promise which resolves upon success of the channel {@link RealtimeChannel.attach | `attach()`} operation and rejects with an {@link ErrorInfo} object upon its failure. When {@link ChannelOptions.attachOnSubscribe} is `false`, no attach is performed.
* Enters the presence set for the channel, optionally passing a `data` payload. A `clientId` is required to be present on a channel.
2309
+
* Enters the presence set for the channel, optionally passing a `data` payload. A `clientId` is required: if the client has no `clientId` (or the wildcard `*`), the call rejects with an {@link ErrorInfo}; set a `clientId` in {@link ClientOptions} or in the token, or use {@link RealtimePresence.enterClient | `enterClient()`} to enter on behalf of another identity. Implicitly attaches the channel if it is not already attached. Once entered, the member is automatically re-entered whenever the channel re-attaches after a disconnection; if that re-enter fails, the failure surfaces as a channel `update` event carrying the {@link ErrorInfo}, not as a rejection.
2276
2310
*
2277
2311
* @param data - The payload associated with the presence member.
2278
2312
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
* Updates the `data` payload for a presence member. If called before entering the presence set, this is treated as an {@link PresenceActions.ENTER} event.
2335
+
* Updates the `data` payload for a presence member. If called before entering the presence set, this is treated as an {@link PresenceActions.ENTER} event. Requires an identified client: if the client has no `clientId` (or the wildcard `*`) set in the {@link ClientOptions} or the token, the call rejects with an {@link ErrorInfo} (use {@link RealtimePresence.updateClient | `updateClient()`} to update on behalf of another identity). Implicitly attaches the channel if it is not already attached.
2297
2336
*
2298
2337
* @param data - The payload to update for the presence member.
2299
2338
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
* Leaves the presence set for the channel. A client must have previously entered the presence set before they can leave it.
2361
+
* Leaves the presence set for the channel. A client must have previously entered the presence set before they can leave it. Requires the client to be identified: when the `clientId` is unset or a wildcard, the call rejects with an {@link ErrorInfo}; to leave on behalf of another identity use {@link RealtimePresence.leaveClient | `leaveClient()`}, which requires a wildcard `clientId` on the API key or token. Unlike {@link RealtimePresence.enter | `enter()`}, leaving does not implicitly attach the channel: the call proceeds only while the channel is `attached` or `attaching`, and rejects with an {@link ErrorInfo} in any other channel state or when the connection is unusable.
2318
2362
*
2319
2363
* @param data - The payload associated with the presence member.
2320
2364
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
* Enters the presence set of the channel for a given `clientId`. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard `clientId`.
2387
+
* Enters the presence set of the channel for a given `clientId`. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard `clientId`; this is enforced by the server rather than the client, so without it the call rejects with an {@link ErrorInfo} returned by the server. Implicitly attaches the channel if it is not already attached. After a transient disconnection the library automatically re-enters the member on re-attach; if that re-enter fails, the failure surfaces as a channel `update` event carrying the {@link ErrorInfo}, not as a rejection.
2339
2388
*
2340
2389
* @param clientId - The ID of the client to enter into the presence set.
2341
2390
* @param data - The payload associated with the presence member.
2342
2391
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
* Updates the `data` payload for a presence member using a given `clientId`. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard `clientId`.
2400
+
* Updates the `data` payload for a presence member using a given `clientId`. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard `clientId`; this is enforced by the server rather than the client, so without it the call rejects with an {@link ErrorInfo} returned by the server. Implicitly attaches the channel if it is not already attached.
2347
2401
*
2348
2402
* @param clientId - The ID of the client to update in the presence set.
2349
2403
* @param data - The payload to update for the presence member.
2350
2404
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
* Leaves the presence set of the channel for a given `clientId`. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard `clientId`.
2413
+
* Leaves the presence set of the channel for a given `clientId`. Enables a single client to update presence on behalf of any number of clients using a single connection. The library must have been instantiated with an API key or a token bound to a wildcard `clientId`; this is enforced by the server rather than the client, so without it the call rejects with an {@link ErrorInfo} returned by the server. Unlike {@link RealtimePresence.enterClient | `enterClient()`}, this call does not implicitly attach the channel; when the channel is neither attached nor attaching it rejects with an {@link ErrorInfo} rather than attaching just to leave.
2355
2414
*
2356
2415
* @param clientId - The ID of the client to leave the presence set for.
2357
2416
* @param data - The payload associated with the presence member.
2358
2417
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
0 commit comments