Event object
Event represents a single piece of information emitted during chat operations: typing indicators, message receipts, mentions, or reports.
Unlike other Chat SDK entities, Event provides no methods - it only passes payloads emitted during chat operations.
Properties
The Event interface has the following properties:
1public protocol Event<T> {
2 associatedtype C: Chat
3 associatedtype T: EventContent
4
5 var chat: C { get }
6 var timetoken: Timetoken { get }
7 var payload: T { get }
8 var channelId: String { get }
9 var userId: String { get }
10}
| Parameter | Description |
|---|---|
chatType: C | Reference to the main ChatImpl object. |
timetokenType: Timetoken | Timetoken of the message that triggered an event. |
payloadType: T | Data passed in an event. For custom events, this is EventContent.Custom with a data: [String: Any] dictionary. Entity-specific events are delivered via dedicated callbacks (onTypingChanged(), onMessageReported(), onReadReceiptReceived(), onMentioned(), onInvited(), onRestrictionChanged()) rather than through this property. |
channelIdType: String | Target channel where this event is delivered. |
userIdType: String | Unique ID of the user that triggered the event. |
Use case
Events enable:
- Collecting historical chat events
- Creating custom events
- Building moderation dashboards for flagged messages
- Triggering business logic with Functions