Event object
An event refers to a single piece of information emitted when someone is typing, receiving a message, mentioning others in a message, or reporting a message to the admin.
The purpose of this struct is to pass payloads of different types emitted when certain chat operations occur.
Properties
The ChatEvent
object has the following properties:
public struct ChatEvent
{
public string TimeToken;
public PubnubChatEventType Type;
public string ChannelId;
public string UserId;
public string Payload;
}
Parameter | Type | Description |
---|---|---|
TimeToken | string | Timetoken of the message that triggered an event. |
Type | PubnubChatEventType | Type of action that emits an event: Typing , Report , Receipt , Mention , Invite , Custom , and Moderation . |
ChannelId | string | Target channel where this event is delivered. |
UserId | string | Unique ID of the user that triggered the event. |
Payload | string | Data passed in an event that differ depending on the event type. |
For details, refer to the chat events documentation.
Use case
You can use events to collect historical chat events or create your own custom events. You can later visualize them in a graphical form (like a moderation dashboard for flagged messages) or create additional business logic with functions that these events can trigger.