Interface MessageEvents<PeerMetadata, TrackMetadata>

Events emitted by the client with their arguments.

interface MessageEvents<PeerMetadata, TrackMetadata> {
    authError: ((reason) => void);
    authSuccess: (() => void);
    bandwidthEstimationChanged: ((estimation) => void);
    componentAdded: ((peer) => void);
    componentRemoved: ((peer) => void);
    componentUpdated: ((peer) => void);
    connectionError: ((error) => void);
    disconnectRequested: ((event) => void);
    disconnected: (() => void);
    joinError: ((metadata) => void);
    joined: ((peerId, peers, components) => void);
    localEndpointMetadataChanged: ((event) => void);
    localTrackAdded: ((event) => void);
    localTrackBandwidthSet: ((event) => void);
    localTrackEncodingBandwidthSet: ((event) => void);
    localTrackEncodingDisabled: ((event) => void);
    localTrackEncodingEnabled: ((event) => void);
    localTrackMetadataChanged: ((event) => void);
    localTrackMuted: ((event) => void);
    localTrackRemoved: ((event) => void);
    localTrackReplaced: ((event) => void);
    localTrackUnmuted: ((event) => void);
    peerJoined: ((peer) => void);
    peerLeft: ((peer) => void);
    peerUpdated: ((peer) => void);
    reconnected: (() => void);
    reconnectionRetriesLimitReached: (() => void);
    reconnectionStarted: (() => void);
    socketClose: ((event) => void);
    socketError: ((event) => void);
    socketOpen: ((event) => void);
    targetTrackEncodingRequested: ((event) => void);
    trackAdded: ((ctx) => void);
    trackReady: ((ctx) => void);
    trackRemoved: ((ctx) => void);
    trackUpdated: ((ctx) => void);
    tracksPriorityChanged: ((enabledTracks, disabledTracks) => void);
}

Type Parameters

  • PeerMetadata
  • TrackMetadata

Properties

authError: ((reason) => void)

Emitted when authentication fails

Type declaration

    • (reason): void
    • Parameters

      • reason: "missing token" | "invalid token" | "expired token" | "room not found" | "peer not found"

      Returns void

authSuccess: (() => void)

Emitted when authentication is successful

Type declaration

    • (): void
    • Returns void

bandwidthEstimationChanged: ((estimation) => void)

Called every time the server estimates client's bandiwdth.

Type declaration

    • (estimation): void
    • Parameters

      • estimation: bigint

        client's available incoming bitrate estimated by the server. It's measured in bits per second.

      Returns void

componentAdded: ((peer) => void)

Called each time new peer joins the room.

Type declaration

componentRemoved: ((peer) => void)

Called each time peer leaves the room.

Type declaration

componentUpdated: ((peer) => void)

Called each time peer has its metadata updated.

Type declaration

connectionError: ((error) => void)

Called in case of errors related to multimedia session e.g. ICE connection.

Type declaration

    • (error): void
    • Parameters

      • error: {
            event?: Event;
            message: string;
        }
        • Optional event?: Event
        • message: string

      Returns void

disconnectRequested: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: any

      Returns void

disconnected: (() => void)

Emitted when the connection is closed

Type declaration

    • (): void
    • Returns void

joinError: ((metadata) => void)

Called when peer was not accepted

Type declaration

    • (metadata): void
    • Parameters

      • metadata: any

        Pass through for client application to communicate further actions to frontend

      Returns void

joined: ((peerId, peers, components) => void)

Called when peer was accepted.

Type declaration

localEndpointMetadataChanged: ((event) => void)

Type declaration

localTrackAdded: ((event) => void)

Type declaration

localTrackBandwidthSet: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: {
            bandwidth: number;
            trackId: string;
        }
        • bandwidth: number
        • trackId: string

      Returns void

localTrackEncodingBandwidthSet: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: {
            bandwidth: number;
            rid: string;
            trackId: string;
        }
        • bandwidth: number
        • rid: string
        • trackId: string

      Returns void

localTrackEncodingDisabled: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      Returns void

localTrackEncodingEnabled: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      Returns void

localTrackMetadataChanged: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      Returns void

localTrackMuted: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: {
            trackId: string;
        }
        • trackId: string

      Returns void

localTrackRemoved: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: {
            trackId: string;
        }
        • trackId: string

      Returns void

localTrackReplaced: ((event) => void)

Type declaration

localTrackUnmuted: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      • event: {
            trackId: string;
        }
        • trackId: string

      Returns void

peerJoined: ((peer) => void)

Called each time new peer joins the room.

Type declaration

peerLeft: ((peer) => void)

Called each time peer leaves the room.

Type declaration

peerUpdated: ((peer) => void)

Called each time peer has its metadata updated.

Type declaration

reconnected: (() => void)

Emitted on successful reconnection

Type declaration

    • (): void
    • Returns void

reconnectionRetriesLimitReached: (() => void)

Emitted when the maximum number of reconnection retries is reached

Type declaration

    • (): void
    • Returns void

reconnectionStarted: (() => void)

Emitted when the process of reconnection starts

Type declaration

    • (): void
    • Returns void

socketClose: ((event) => void)

Emitted when the websocket connection is closed

Type declaration

    • (event): void
    • Parameters

      • event: CloseEvent

        Close event object from the websocket

      Returns void

socketError: ((event) => void)

Emitted when occurs an error in the websocket connection

Type declaration

    • (event): void
    • Parameters

      • event: Event

        Event object from the websocket

      Returns void

socketOpen: ((event) => void)

Emitted when the websocket connection is opened

Type declaration

    • (event): void
    • Parameters

      • event: Event

        Event object from the websocket

      Returns void

targetTrackEncodingRequested: ((event) => void)

Type declaration

    • (event): void
    • Parameters

      Returns void

trackAdded: ((ctx) => void)

Called each time the peer which was already in the room, adds new track. Fields track and stream will be set to null. These fields will be set to non-null value in MessageEvents.trackReady

Type declaration

trackReady: ((ctx) => void)

Called when data in a new track arrives.

This callback is always called after MessageEvents.trackAdded. It informs user that data related to the given track arrives and can be played or displayed.

Type declaration

trackRemoved: ((ctx) => void)

Called when some track will no longer be sent.

It will also be called before MessageEvents.peerLeft for each track of this peer.

Type declaration

trackUpdated: ((ctx) => void)

Called each time peer has its track metadata updated.

Type declaration

tracksPriorityChanged: ((enabledTracks, disabledTracks) => void)

Currently, this callback is only invoked when DisplayManager in RTC Engine is enabled and simulcast is disabled.

Called when priority of video tracks have changed.

Type declaration