Get the latest occupancy data received from realtime events.
The latest occupancy data, or undefined if no realtime events have been received yet.
Get the current occupancy of the chat room.
A promise that resolves to the current occupancy of the chat room.
Subscribe a given listener to occupancy updates of the chat room.
Note: This requires occupancy events to be enabled via the enableEvents
option in
the OccupancyOptions options provided to the room. If this is not enabled, an error will be thrown.
A listener to be called when the occupancy of the room changes.
A subscription object that can be used to unsubscribe the listener.
This interface is used to interact with occupancy in a chat room: subscribing to occupancy updates and fetching the current room occupancy metrics.
Get an instance via Room.occupancy.