Listening for Events

LAST EDIT Nov 04 2024

As soon as you call watch on a Channel or queryChannels you’ll start to listen to these events. You can hook into specific events:

You can also listen to all events at once: (Full list of events is on events object page)

Client Events

Copied!

Not all events are specific to channels. Events such as the user's status has changed, the users' unread count has changed, and other notifications are sent as client events. These events can be listened to through the client directly:

Connection Events

Copied!

The official SDKs make sure that a connection to Stream is kept alive at all times and that chat state is recovered when the user's internet connection comes back online. Your application can subscribe to changes to the connection using client events.

Stop Listening for Events

Copied!

It is a good practice to unregister event handlers once they are not in use anymore. Doing so will save you from performance degradations coming from memory leaks or even from errors and exceptions (i.e. null pointer exceptions)