Event Object

Events

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.

EventTriggerRecipientsType
channel.deletedwhen a channel is deletedclients watching the channelchannel event
channel.hiddenwhen a channel is mark as hiddenclients from the user that marked the user as hidden (see hiding channels)channel event
channel.truncatedwhen a channels’ history is truncatedclients watching the channelchannel event
channel.updatedwhen a channel is updatedclients watching the channelchannel event
channel.visiblewhen a channel is made visibleclients from the user that marked the user as visible (see hiding channels)channel event
connection.changedwhen the state of the connection changedlocal eventclient event
connection.recoveredwhen the connection to chat servers is back onlinelocal eventclient event
health.checkevery 30 second to confirm that the client connection is still aliveall clientsclient event
member.addedwhen a member is added to a channelclients watching the channelchannel event
member.removedwhen a member is removed from a channelclients watching the channelchannel event
member.updatedwhen a channel member is updated (promoted to moderator/accepted/.rejected the invite)clients watching the channelchannel event
message.deletedwhen a message is deletedclients watching the channelchannel event
message.newwhen a new message is added on a channelclients watching the channelchannel event
message.readwhen a channel is marked as readclients watching the channelchannel event
message.updatedwhen a message is updatedclients watching the channelchannel event
notification.added_to_channelwhen the user is added to the list of channel membersclients from the user added that are not watching the channelnotification event
notification.channel_deletedwhen a channel is deletedclients from members that are not watching the channelnotification event
notification.channel_mutes_updatedwhen a channel is mutedclients from the user that muted the channelnotification event
notification.channel_truncatedwhen a channels’ history is truncatedclients from members that are not watching the channelnotification event
notification.invite_acceptedwhen the user accepts an inviteclients from the user invited that are not watching the channelnotification event
notification.invite_rejectedwhen the user rejects an inviteclients from the user invited that are not watching the channelnotification event
notification.invitedwhen the user is invited to join a channelclients from the user invited that are not watching the channelnotification event
notification.mark_readwhen the total count of unread messages (across all channels the user is a member) changesclients from the user with the new unread countnotification event
notification.message_newwhen a message is added to a channelclients that are not currently watching the channelnotification event
notification.mutes_updatedwhen the user mutes are updatedclients from the user that updated the list of mutesnotification event
notification.removed_from_channelwhen a user is removed from the list of channel membersclients from the user removed that are not watching the channelnotification event
reaction.deletedwhen a message reaction is deletedclients watching the channelchannel event
reaction.newwhen a message reaction is addedclients watching the channelchannel event
reaction.updatedwhen a message reaction is updatedclients watching the channelchannel event
typing.startwhen a user starts typingclients watching the channelchannel event
typing.stopwhen a user stops typingclients watching the channelchannel event
user.bannedwhen the user is bannedclients for the banned userclient event
user.deletedwhen a user is deletedclients subscribed to the user statususer presence event
user.presence.changedwhen a user status changes (eg. online, offline, away, etc.)clients subscribed to the user statususer presence event
user.unbannedwhen the user ban is liftedclients for the banned userclient event
user.updatedwhen a user is updatedclients subscribed to the user statususer presence event
user.watching.startwhen a user starts watching a channelclients watching the channelchannel event
user.watching.stopwhen a user stops watching a channelclients watching the channelchannel event
notification.mark_unreadwhen the user marks a message as unreadclients from the user with the new unread countnotification event

Event Object

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
© Getstream.io, Inc. All Rights Reserved.