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;
}
ParameterTypeDescription
TimeTokenstringTimetoken of the message that triggered an event.
TypePubnubChatEventTypeType of action that emits an event: Typing, Report, Receipt, Mention, Invite, Custom, and Moderation.
ChannelIdstringTarget channel where this event is delivered.
UserIdstringUnique ID of the user that triggered the event.
PayloadstringData 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.

Last updated on
On this page