Event Object

LAST EDIT Jul 29 2024

Events

Copied!

Events allow the client to stay up to date with changes to the chat. Examples are a new message, a user's image that updated, a reaction, or a member joining the channel. There are a 4 different type of events. These first 2 types of events you receive if you're connected to Stream, no further action is needed to receive these events:

  • Client events: You always receive these events. Examples are connection.recovered, health.check and connection.changed

  • Notification events: Notification events notify you when something changed on a channel you are a member of even if you're not explicitly watching that channel. One example is someone starting a new channel to message you while you are currently in the app. All notification event type start with notification

The last 2 groups of events require you to subscribe to them

  • User presence events: queryUsers, queryChannels and channel.watch() allow you to specify presence=True, if you specify this option you'll opt in to receiving updates about the users on these channels. You'll receive events when they go online/offline or their data is updated

  • Channel events: if you call queryChannels with watch=true, or you call channel.watch() you'll opt-in to receiving events for the given channels. Examples are new messages, people joining the chat etc.

A full list of events is shown below. The next section of the documentation explains how to listen for events.

Event

Trigger

Recipients

Type

channel.deleted

when a channel is deleted

clients watching the channel

channel event

channel.hidden

when a channel is mark as hidden

clients from the user that marked the user as hidden (see hiding channels)

channel event

channel.truncated

when a channels' history is truncated

clients watching the channel

channel event

channel.updated

when a channel is updated

clients watching the channel

channel event

channel.visible

when a channel is made visible

clients from the user that marked the user as visible (see hiding channels)

channel event

connection.changed

when the state of the connection changed

local event

client event

connection.recovered

when the connection to chat servers is back online

local event

client event

health.check

every 30 second to confirm that the client connection is still alive

all clients

client event

member.added

when a member is added to a channel

clients watching the channel

channel event

member.removed

when a member is removed from a channel

clients watching the channel

channel event

member.updated

when a channel member is updated (promoted to moderator/accepted/.rejected the invite)

clients watching the channel

channel event

message.deleted

when a message is deleted

clients watching the channel

channel event

message.new

when a new message is added on a channel

clients watching the channel

channel event

message.read

when a channel is marked as read

clients watching the channel

channel event

message.updated

when a message is updated

clients watching the channel

channel event

notification.added_to_channel

when the user is added to the list of channel members

clients from the user added that are not watching the channel

notification event

notification.channel_deleted

when a channel is deleted

clients from members that are not watching the channel

notification event

notification.channel_mutes_updated

when a channel is muted

clients from the user that muted the channel

notification event

notification.channel_truncated

when a channels' history is truncated

clients from members that are not watching the channel

notification event

notification.invite_accepted

when the user accepts an invite

clients from the user invited that are not watching the channel

notification event

notification.invite_rejected

when the user rejects an invite

clients from the user invited that are not watching the channel

notification event

notification.invited

when the user is invited to join a channel

clients from the user invited that are not watching the channel

notification event

notification.mark_read

when the total count of unread messages (across all channels the user is a member) changes

clients from the user with the new unread count

notification event

notification.message_new

when a message is added to a channel

clients that are not currently watching the channel

notification event

notification.mutes_updated

when the user mutes are updated

clients from the user that updated the list of mutes

notification event

notification.removed_from_channel

when a user is removed from the list of channel members

clients from the user removed that are not watching the channel

notification event

reaction.deleted

when a message reaction is deleted

clients watching the channel

channel event

reaction.new

when a message reaction is added

clients watching the channel

channel event

reaction.updated

when a message reaction is updated

clients watching the channel

channel event

typing.start

when a user starts typing

clients watching the channel

channel event

typing.stop

when a user stops typing

clients watching the channel

channel event

user.banned

when the user is banned

clients for the banned user

client event

user.deleted

when a user is deleted

clients subscribed to the user status

user presence event

user.presence.changed

when a user status changes (eg. online, offline, away, etc.)

clients subscribed to the user status

user presence event

user.unbanned

when the user ban is lifted

clients for the banned user

client event

user.updated

when a user is updated

clients subscribed to the user status

user presence event

user.watching.start

when a user starts watching a channel

clients watching the channel

channel event

user.watching.stop

when a user stops watching a channel

clients watching the channel

channel event

notification.mark_unread

when the user marks a message as unread

clients from the user with the new unread count

notification event

Event Object

Copied!
nametypedescriptiondefaultoptional
cidstringChannel ID
typestringEvent type
messageobjectMessage Object
reactionobjectReaction Object
channelobjectChannel Object
memberobjectUser object for the channel member that was added/removed
userobjectUser object of the current user
meobjectUser object of the health check user
total_unread_countintthe number of unread messages for current user
watcher_countintNumber of users watching this channel