val sub = client.subscribe { event: VideoEvent ->
logger.d { event.toString() }
}
// stop listening
sub.dispose()
Events
In most cases you can simply use the Stateflow
objects Stream exposes.
However for some customizations you’ll want to listen to the underlying events that power these state objects.
Listening to events
Both the call and client object allow you to subscribe to events. You can listen to a specific event or all of them. This example shows how to listen to all events
You can also subscribe to call events.
val call = client.call("default", "123")
val sub = call.subscribe { event: VideoEvent ->
logger.d { event.toString() }
}
// stop listening
sub.dispose()
Or listen to a specific event.
val sub = client.subscribeFor<ConnectedEvent> { event ->
logger.d { event.toString() }
}
// stop listening
sub.dispose()
Events
The following events are emitted by the client:
Event Name | Description |
---|---|
BlockedUserEvent | This event is sent to call participants to notify when a user is blocked on a call. Clients can use this event to show a notification. If the user is the current user, the client should leave the call screen as well. |
CallAcceptedEvent | This event is sent when a user accepts a notification to join a call. |
CallCreatedEvent | This event is sent when a call is created. Clients receiving this event should check if the ringing field is set to true and if so, show the call screen. |
CallEndedEvent | This event is sent when a call is marked as ended for all its participants. Clients receiving this event should leave the call screen. |
CallHLSBroadcastingStartedEvent | This event is sent when call HLS broadcasting has started. |
CallHLSBroadcastingStoppedEvent | This event is sent when call HLS broadcasting has stopped. |
CallHLSBroadcastingFailedEvent | This event indicates that call HLS broadcasting has failed. |
CallLiveStartedEvent | This event is sent when a livestream has started. |
CallMemberAddedEvent | This event is sent when one or more members are added to a call. |
CallMemberRemovedEvent | This event is sent when one or more members are removed from a call. |
CallMemberUpdatedEvent | This event is sent when one or more members are updated. |
CallMemberUpdatedPermissionEvent | This event is sent when one or more members get their role capabilities updated. |
CallReactionEvent | This event is sent when a reaction is sent in a call, clients should use this to show the reaction in the call screen |
CallRecordingStartedEvent | This event is sent when call recording has started. |
CallRecordingStoppedEvent | This event is sent when call recording has stopped. |
CallRecordingReadyEvent | Indicates that a call recording is ready. |
CallRecordingFailedEvent | Indicates that recording a call failed. |
CallRejectedEvent | This event is sent when a user rejects a notification to join a call. |
CallRingEvent | This event is sent to all call members to notify they are getting called. |
CallSessionStartedEvent | This event is sent when a call session starts. |
CallSessionEndedEvent | This event is sent when a call session ends. |
CallSessionParticipantJoinedEvent | This event is sent when a participant joins a call session. |
CallSessionParticipantLeftEvent | This event is sent when a participant leaves a call session. |
CallTranscriptionStartedEvent | This event indicates that call transcribing has started. |
CallTranscriptionStoppedEvent | Indicates that call transcribing has stopped. |
CallTranscriptionReadyEvent | This event is sent when call transcriptions are ready. |
CallTranscriptionFailedEvent | Indicates that call transcribing failed. |
CallUpdatedEvent | This event is sent when a call is updated. Clients should use this update the local state of the call. This event also contains the capabilities by role for the call, clients should update the own_capability for the current. |
ConnectedEvent | This event is sent when the WS connection is established and authenticated. This event contains the full user object as it is stored on the server. |
ConnectionErrorEvent | This event is sent when the WS connection attempt fails. |
HealthCheckEvent | Periodic event used to check the connection health. |
PermissionRequestEvent | This event is sent when a user requests access to a feature on a call, clients receiving this event should display a permission request to the user. |
UnblockedUserEvent | This event is sent when a user is unblocked on a call. This can be useful to notify the user that they can now join the call again. |
UpdatedCallPermissionsEvent | This event is sent to notify about permission changes for a user. Clients receiving this event should update their UI accordingly. |
VideoEvent | The discriminator object for all websocket events, you should use this to map event payloads to the correct type. |
WSCallEvent | Placeholder for all call events. |
WSClientEvent | Placeholder for all client events. |
CustomVideoEvent | A custom event. This event is used to send custom events to other participants in the call. |
On this page: