Skip to main content
The UI Kit has an event bus. It carries what this user did through the Kit — sent a message, blocked someone, kicked a member — so every other component showing the same data can update. The Chat SDK already tells you what other people did. It does not echo this user’s own actions back, which is why the bus exists: the component that performed the action announces it, and the others react. SDK callbacks are not forwarded onto the Kit’s buses, so listen to the SDK directly for other people’s messages, typing and receipts.

Event Families

Events come in families: message, user, group, conversation, call, thread and UI.
The bus is CometChatEvents. Each family has a modifier that listens to every event in it, and most events also have a modifier named after them.Events with no per-event modifier — replyToMessage, messageEditedByOther, messageDeletedByOther, messagesDeliveredToAll, messagesReadByAll, messageModerated, interactionGoalCompleted, conversationUpdated, showPanel, hidePanel, agentChatThreadResolved, cardActionClicked and the thread family’s subscriptionChanged — arrive through the family modifier.

Listening to Events

Every event has a modifier named after it. It listens while the view is on screen and stops when the view goes. The closure receives the event’s fields.
Each family also has one modifier for every event in it:
Outside a view — in a store or a service — iterate the family’s stream. Leaving the loop, or cancelling its task, stops listening.
Handlers run on the main thread, in the order the events were emitted. In SwiftUI, a stream listener that falls behind keeps the newest events of each family — 64 message, 32 group, 16 user, conversation, UI and thread, 8 call — and loses older ones.

Emitting Events

Some actions happen on screens you build — a profile screen with a block button, a group-details screen that adds members. The Kit cannot see them, so emit the event yourself, or the Kit’s lists go stale.

Sending Through the Kit

Send through the Kit rather than the SDK, and the message is announced as it is sent, as it succeeds and if it fails — so the message list and Conversations update without any wiring.
Send with CometChatSession:
The sender, the local id (muid) and the sent time are filled in when missing. A custom message is sent with its push notification on. On failure the message’s metadata holds the error under error, errorCode and errorDetails, and the function throws.

Thread Subscription

Following a thread is on by default. CometChatThreadSubscription holds the rules the Kit uses; call it from your own control to stay in step with the Kit’s.
toggle updates every surface at once, then asks the server, and puts the old state back if the server refuses. It returns nil — and does nothing — while a toggle for the same thread is in flight or ran in the last 400 ms. Every change is announced as the thread family’s .subscriptionChanged(parentMessageId:subscribed:).

Next Steps

Customization Events

React to events in your own screens

Message List

The component most events update

Conversations

Stays in step with the events your screens emit

Groups

Follows group events from anywhere in the Kit