Readonly
unsubscribeThis method should be called when the subscription is no longer needed, it will make sure no further events will be sent to the subscriber and that references to the subscriber are cleaned up.
Get the previous messages that were sent to the room before the listener was subscribed.
If the client experiences a discontinuity event (i.e. the connection was lost and could not be resumed), the starting point of historyBeforeSubscribe will be reset.
Calls to historyBeforeSubscribe will wait for continuity to be restored before resolving.
Once continuity is restored, the subscription point will be set to the beginning of this new period of continuity. To ensure that no messages are missed, you should call historyBeforeSubscribe after any period of discontinuity to fill any gaps in the message history.
const { historyBeforeSubscribe } = room.messages.subscribe(listener);
await historyBeforeSubscribe({ limit: 10 });
Options for the history query.
A promise that resolves with the paginated result of messages, in newest-to-oldest order.
A response object that allows you to control a message subscription.