LiveKit JS Client SDK - v2.25.0
    Preparing search index...

    Interface DataStreamLocalParticipantApiExperimental

    Methods the dataStreams extension adds to the local participant.

    interface DataStreamLocalParticipantApi {
        sendBytes(
            bytes: Uint8Array,
            options?: SendBytesOptions,
        ): Promise<ByteStreamInfo>;
        sendFile(file: File, options?: SendFileOptions): Promise<{ id: string }>;
        sendText(text: string, options?: SendTextOptions): Promise<TextStreamInfo>;
        streamBytes(options?: StreamBytesOptions): Promise<ByteStreamWriter>;
    }

    Hierarchy (View Summary)

    Index
    • Experimental

      Sends the given bytes to participants in the room via the data channel. For files, consider using sendFile; for longer/incremental payloads, streamBytes.

      Parameters

      • bytes: Uint8Array

        The byte payload

      • Optionaloptions: SendBytesOptions
        • Optionalattributes?: Record<string, string>
        • Optionalcompress?: boolean

          Whether to compress the payload (deflate-raw). Defaults to true. Compression is only applied when every recipient supports data streams v2 and the runtime can compress.

        • OptionaldestinationIdentities?: string[]
        • OptionalmimeType?: string
        • Optionalname?: string
        • OptionalonProgress?: (progress: number) => void
        • Optionaltopic?: string

      Returns Promise<ByteStreamInfo>

    • Experimental

      Send a File to all participants in the room via the data channel.

      Parameters

      • file: File

        The File object payload

      • Optionaloptions: SendFileOptions
        • topic

          Topic identifier used to route the stream to appropriate handlers.

        • onProgress

          A callback function used to monitor the upload progress percentage.

      Returns Promise<{ id: string }>

    • Experimental

      Sends the given string to participants in the room via the data channel. For longer messages, consider using streamText instead.

      Parameters

      • text: string

        The text payload

      • Optionaloptions: SendTextOptions
        • Optionalattachments?: File[]
        • Optionalattributes?: Record<string, string>
        • Optionalcompress?: boolean

          Whether to compress the payload (deflate-raw). Defaults to true. Compression is only applied when every recipient supports data streams v2 and the runtime can compress.

        • OptionaldestinationIdentities?: string[]
        • OptionalonProgress?: (progress: number) => void
        • Optionaltopic?: string

      Returns Promise<TextStreamInfo>

    • Experimental

      Stream bytes incrementally to participants in the room via the data channel. For sending files, consider using sendFile instead.

      Parameters

      • Optionaloptions: StreamBytesOptions
        • topic

          Topic identifier used to route the stream to appropriate handlers.

      Returns Promise<ByteStreamWriter>