Event Object
Confused about "Event Object"?
Let us know how we can improve our documentation:
Last Edit:
Jan 26 2021
Events
The following events are used by Stream's Chat SDK. There are two type of events: client events and channel events.
Client events are events sent to notify users about other users or for notifications related to their own user. A user coming online or a notification that a user received an invite to a channel are client events.
Channel events are events sent to all users watching a channel where the event originated. These events always include the channel information.
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 |
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 | client event |
notification.channel_deleted | when a channel is deleted | clients from members that are not watching the channel | client event |
notification.channel_mutes_updated | when a channel is muted | clients from the user that muted the channel | client event |
notification.channel_truncated | when a channels' history is truncated | clients from members that are not watching the channel | client event |
notification.invite_accepted | when the user accepts an invite | clients from the user invited that are not watching the channel | client event |
notification.invite_rejected | when the user rejects an invite | clients from the user invited that are not watching the channel | client event |
notification.invited | when the user is invited to join a channel | clients from the user invited that are not watching the channel | client 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 | client event |
notification.message_new | when a message is added to a channel | clients that are not currently watching the channel | client event |
notification.mutes_updated | when the user mutes are updated | clients from the user that updated the list of mutes | client 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 | client 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 | sent when a user starts typing | clients watching the channel | channel event |
typing.stop | sent when a user stops typing | clients watching the channel | channel event |
user.banned | sent when the user is banned | clients for the banned user | client event |
user.presence.changed | when a user status changes (eg. online, offline, away, etc.) | clients subscribed to the user status | client event |
user.unbanned | sent 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 | client 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 |
Event Object
Name | Type | Description | Default | Optional |
---|---|---|---|---|
cid | string | Channel ID | ✓ | |
type | string | Event type | ||
message | object | Message Object | ✓ | |
reaction | object | Reaction Object | ✓ | |
channel | object | Channel Object | ✓ | |
member | object | User object for the channel member that was added/removed | ✓ | |
user | object | User object of the current user | ✓ | |
me | object | User object of the health check user | ✓ | |
total_unread_count | int | the number of unread messages for current user | ✓ | |
watcher_count | int | Number of users watching this channel | ✓ |