subscribe

View as Markdown

subscribe

Listens for the events for which you have provided event handlers and returns the RoomSessionFullState that contains the full state of the room session.

Note that you don’t need to manually call this method to start listening to events, since they are listened automatically.

Returns

Promise<RoomSessionFullState> - See RoomSessionFullState for more details.

Example

1const client = ... // get a client with createClient()
2
3client.video.on('room.started', async (roomSession) => {
4 // attach event listeners...
5 // roomSession.on(...)
6
7 // This gives you the full state of the room session!
8 const roomSessionState = await roomSession.subscribe()
9 console.log('room name:', roomSessionState.name)
10 console.log('members:', roomSessionState.members)
11}