userLeft
Emitted when a user has left the room.
You can discriminate between the local user and remote users by the type
field inside the event data
. The reason
field tells if user was kicked, the session has ended, or it was just a normal (generic) leave.
Sample payload
{
"type": "userLeft",
"data": {
"type": "local",
"reason": "generic/kicked/sessionEnded",
"user": {
"id": "d31ddb8a-07f7-44d0-ba4b-31b5a8e28f68",
"name": "John Smith",
....................
}
}
}
Sample subscription code
sambaFrame.on('userLeft', (event) => {
const data = event.data;
if (data.type === 'local') {
console.log('You have left the room');
} else {
console.log(data.user.name, 'has left the room');
}
});
Last updated