Real-time events are delivered to the SDK through a WebSocket. These events can be subscribed to using the following methods.
Subscribe to an event
sdk.on("profileUpdated", function (event) {
console.log("profileUpdated", event);
});Unsubscribe from an event
sdk.off("profileUpdated");Complete list of events
Event Name | Event Payload | Description |
|---|---|---|
conversationDeleted | Sent when a conversation is deleted. | |
conversationUndeleted | Sent when a conversation is undeleted. | |
conversationUpdated | Sent when a conversation is updated. | |
participantAdded | Sent when a participant is added to a conversation. When a conversation is created, this event also fires with the owner's | |
participantRemoved | Sent when a participant is removed from a conversation. App needs to check whether the participant is the current user and locally remove the conversation from the UI. | |
participantTyping | Sent when a participant is typing in a conversation. | |
profileUpdated | Sent when a user's profile is updated. | |
conversationMessageEvent | This event is sent for all conversation message related activity. It encapsulates the It’s defined like this so you can handle WebSocket conversation message events and events requested from |
IConversationDeletedEventData
export interface IConversationDeletedEventData {
conversationId: string;
createdBy: string;
timestamp: string;
} IConversationUndeletedEventData
export interface IConversationUndeletedEventData {
conversationId: string;
createdBy: string;
timestamp: string;
} IConversationUpdatedEventData
export interface IConversationUpdatedEventData {
conversationId: string;
createdBy: string;
name: string;
description: string;
roles: IConversationRoles;
isPublic: boolean;
timestamp: string;
} IParticipantAddedEventData
export interface IParticipantAddedEventData {
conversationId: string;
createdBy: string;
profileId: string;
role: string;
timestamp: string;
}IParticipantRemovedEventData
export interface IParticipantRemovedEventData {
conversationId: string;
createdBy: string;
profileId: string;
timestamp: string;
}IParticipantTypingEventData
export interface IParticipantTypingEventData {
conversationId: string;
createdBy: string;
profileId: string;
timestamp: string;
}IProfileUpdatedEvent
export interface IProfileUpdatedEvent {
eTag: string;
profile: any;
}IConversationMessageEvent
This event encapsulates sent, delivered and read events.
export interface IConversationMessageEvent {
eventId: string;
// name field will be ["conversationMessage.sent" | "conversationMessage.read" | "conversationMessage.delivered"]
name: string;
conversationId: string;
conversationEventId: number;
// payload will differ based on event name ...
payload: IMessageSentPayload | IMessageStatusUpdatePayload;
}
// payload for conversationMessage.sent
export interface IMessageSentPayload {
messageId: string;
metadata: any;
context: any;
parts: IMessagePart[];
alert: IMessageAlert;
}
// payload for conversationMessage.delivered, conversationMessage.read
export interface IMessageStatusUpdatePayload {
messageId: string;
conversationId: string;
profileId: string;
timestamp: string;
}