LiveKit JS Server SDK - v2.13.3
    Preparing search index...

    Class RoomServiceClient

    Client to access Room APIs

    Hierarchy

    • ServiceBase
      • RoomServiceClient
    Index

    Constructors

    • Parameters

      • host: string

        hostname including protocol. i.e. 'https://.livekit.cloud'

      • OptionalapiKey: string

        API Key, can be set in env var LIVEKIT_API_KEY

      • Optionalsecret: string

        API Secret, can be set in env var LIVEKIT_API_SECRET

      Returns RoomServiceClient

    Methods

    • Forwards a participant's track to another room. This will create a participant to join the destination room that has same information with the source participant except the kind to be Forwarded. All changes to the source participant will be reflected to the forwarded participant. When the source participant disconnects or the RemoveParticipant method is called in the destination room, the forwarding will be stopped.

      Parameters

      • room: string
      • identity: string
      • destinationRoom: string

        the room to forward the participant to

      Returns Promise<void>

    • Get information on a specific participant, including the tracks that participant has published

      Parameters

      • room: string

        name of the room

      • identity: string

        identity of the participant to return

      Returns Promise<ParticipantInfo>

    • Move a connected participant to a different room. Requires roomAdmin and destinationRoom. The participant will be removed from the current room and added to the destination room. From the other observers' perspective, the participant would've disconnected from the previous room and joined the new one.

      Parameters

      • room: string
      • identity: string
      • destinationRoom: string

        the room to move the participant to

      Returns Promise<void>

    • Mutes a track that the participant has published.

      Parameters

      • room: string
      • identity: string
      • trackSid: string

        sid of the track to be muted

      • muted: boolean

        true to mute, false to unmute

      Returns Promise<TrackInfo>

    • Removes a participant in the room. This will disconnect the participant and will emit a Disconnected event for that participant. Even after being removed, the participant can still re-join the room.

      Parameters

      • room: string
      • identity: string

      Returns Promise<void>

    • Sends data message to participants in the room

      Parameters

      • room: string
      • data: Uint8Array

        opaque payload to send

      • kind: DataPacket_Kind

        delivery reliability

      • options: SendDataOptions

        optionally specify a topic and destinationSids (when destinationSids is empty, message is sent to everyone)

      Returns Promise<void>

    • Sends data message to participants in the room

      Parameters

      • room: string
      • data: Uint8Array

        opaque payload to send

      • kind: DataPacket_Kind

        delivery reliability

      • OptionaldestinationSids: string[]

        optional. when empty, message is sent to everyone

      Returns Promise<void>

      use sendData(room, data, kind, options) instead

    • Updates a participant's state or permissions

      Parameters

      • room: string

        target room

      • identity: string

        participant identity

      • options: UpdateParticipantOptions

        participant fields to update

      Returns Promise<ParticipantInfo>

    • Updates a participant's state or permissions

      Parameters

      • room: string

        target room

      • identity: string

        participant identity

      • Optionalmetadata: string
      • Optionalpermission: Partial<ParticipantPermission>
      • Optionalname: string

      Returns Promise<ParticipantInfo>

    • Updates a participant's subscription to tracks

      Parameters

      • room: string
      • identity: string
      • trackSids: string[]
      • subscribe: boolean

        true to subscribe, false to unsubscribe

      Returns Promise<void>