Skip to main content

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

val sub = client.subscribe { event: VideoEvent ->
logger.d { event.toString() }
}
// stop listening
sub.dispose()

You can also subscribe for a specific call

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> { newMessageEvent ->
logger.d { newMessageEvent.toString() }
}
// stop listening
sub.dispose()

Events

The following events are triggered by the client:

TODO

Did you find this page helpful?