peerix - v0.8.0
    Preparing search index...

    Interface ChannelMessageEvent<M>

    Emitted when a message is received on a data channel.

    room.on("channel:message", async (e) => {
    if (e.type === "text") console.log(await e.data);
    });
    interface ChannelMessageEvent<M extends object = Metadata> {
        channel: RTCDataChannel;
        data: ReadableStream<Uint8Array<ArrayBufferLike>> & PromiseLike<unknown>;
        info?: Record<string, unknown>;
        label: string;
        name: "channel:message";
        peer: Peer<M>;
        raw?: false;
        type: DataType;
    }

    Type Parameters

    Hierarchy (View Summary)

    Index
    channel: RTCDataChannel

    Data channel associated with the event.

    data: ReadableStream<Uint8Array<ArrayBufferLike>> & PromiseLike<unknown>

    Received message, readable as a stream of chunks or awaited as a whole.

    Read or cancel it: the sender's later messages on this channel wait until the receiver has read most of a large message. A message that has no channel or channel:message listener is read and discarded.

    info?: Record<string, unknown>

    Information the sender attached to the message with the info send option.

    label: string

    Label of the data channel.

    name: "channel:message"

    Name of the event.

    peer: Peer<M>

    Peer object containing connection details.

    raw?: false

    Always false or absent here; a channel with a protocol emits ChannelRawMessageEvent.

    type: DataType

    Detected type of the message, which decides what data resolves to.