For AI agents: this page in Markdown: https://www.pubnub.com/docs/chat/chat-sdk/learn/chat-entities/event.md. Documentation index: https://www.pubnub.com/llms-full.txt.
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.
Deprecated event types
Many EventPayloads types (TypingEventPayload, ReportEventPayload, ReceiptEventPayload, MentionEventPayload, InviteEventPayload, ModerationEventPayload, CustomEventPayload) are deprecated. Use entity-level methods instead (for example, channel.onTypingChanged(), user.onMentioned(), channel.onMessageReported()). See Custom events for the full mapping.
Properties
Event has the following properties:
1class Event<T extends EventType> {
2 timetoken: string
3 type: T
4 payload: EventPayloads[T]
5 channelId: string
6 userId: string
7}
Use case
Events enable:
- Collecting historical chat events
- Creating custom events
- Building moderation dashboards for flagged messages
- Triggering business logic with Functions