Interface RtmClientEvents

Event listener type of the RtmClient instance. In this interface, the function property’s name is the event name; the function property’s parameters is the parameters of the event listener function.

Example

Listening to peer-to-peer messages.

client.on('MessageFromPeer', function (message, peerId) {
// Your code.
});

Hierarchy

  • RtmClientEvents

Events

ConnectionStateChanged: ((newState: ConnectionState, reason: ConnectionChangeReason) => void)

Type declaration

MessageFromPeer: ((message: RtmMessage, peerId: string, messageProps: ReceivedMessageProperties) => void)

Type declaration

    • (message: RtmMessage, peerId: string, messageProps: ReceivedMessageProperties): void
    • Occurs when the local user receives a peer-to-peer message from a remote user.

      Parameters

      • message: RtmMessage

        The received peer-to-peer message object.

      • peerId: string

        The uid of the sender.

      • messageProps: ReceivedMessageProperties

        The properties of the received message.

      Returns void

RemoteInvitationReceived: ((remoteInvitation: RemoteInvitation) => void)

Type declaration

Properties

PeersOnlineStatusChanged: ((status: PeersOnlineStatusMap) => void)

Type declaration

    • (status: PeersOnlineStatusMap): void
    • Occurs when the online status of the peers, to whom you subscribe, changes.

      • When the subscription to the online status of specified peer(s) succeeds, the SDK returns this callback to report the online status of peers, to whom you subscribe.
      • When the online status of the peers, to whom you subscribe, changes, the SDK returns this callback to report whose online status has changed.
      • If the online status of the peers, to whom you subscribe, changes when the SDK is reconnecting to the server, the SDK returns this callback to report whose online status has changed when successfully reconnecting to the server.

      Parameters

      Returns void

TokenExpired: (() => void)

Type declaration

    • (): void
    • Occurs when the RTM server detects that the RTM token has exceeded the 24-hour validity period and when the SDK is in the RECONNECTING state.

      • This callback occurs only when the SDK is reconnecting to the server. You will not receive this callback when the SDK is in the CONNECTED state.
      • When receiving this callback, generate a new RTM Token on the server and call the renewToken method to pass the new Token on to the server.

      Returns void

Generated using TypeDoc