Skip to content

five-on-it / packages/protocol/src/rtc / encodeRtcSignal

Function: encodeRtcSignal() ​

encodeRtcSignal(signal): string

Defined in: packages/protocol/src/rtc.ts:93

Serializes a signalling frame as a text frame (type first, as isRtcFrame expects).

Parameters ​

signal ​

{ op: "offer"; sdp: string; type: "rtc"; } | { op: "answer"; sdp: string; type: "rtc"; } | { candidate: { candidate: string; sdpMid?: string | null; sdpMLineIndex?: number | null; usernameFragment?: string | null; }; op: "candidate"; type: "rtc"; } | { op: "close"; reason: "full" | "failed" | "dropped" | "timeout" | "silence" | "worker" | "remote" | "frames"; type: "rtc"; }

Returns ​

string