RTCForge API Reference v1.1.1
    Preparing search index...

    Drives the connect-and-join exchange, resolving once the server confirms the room.

    run connects the Transport and waits for a RoomJoined frame, rejecting on an Error frame or after joinTimeoutMs. The message listener stays attached after settling and buffers any frames that arrive in the same batch as RoomJoined (the transport can deliver several synchronously); those are replayed to steady-state handling via drain.

    Index

    Constructors

    Methods

    Constructors

    Methods

    • Detach the handshake listener and replay any frames buffered between the room-joined settle and now, so no early signal is lost. Call once, after the steady-state message handler is attached.

      Parameters

      • handler: (
            msg:
                | {
                    iceServers?: {
                        credential?: string;
                        urls: string
                        | string[];
                        username?: string;
                    }[];
                    localRole?: string;
                    peerId: string;
                    peerMetadata?: Record<string, Record<string, string>>;
                    peerRoles?: Record<string, string>;
                    peers: string[];
                    roomId: string;
                    type: "room-joined";
                    v?: number;
                }
                | {
                    metadata?: Record<string, string>;
                    peerId: string;
                    role?: string;
                    type: "peer-joined";
                }
                | { peerId: string; type: "peer-left" }
                | { peerId: string; type: "presence-online" }
                | { peerId: string; type: "presence-offline" }
                | { peerId: string; reason?: string; type: "kicked" }
                | { data: unknown; from: string; type: "signal" }
                | {
                    channel: string;
                    data?: unknown;
                    from: string;
                    ts: number;
                    type: "broadcast";
                }
                | { code: string; message: string; type: "error" }
                | { type: "ping" }
                | { peerId: string; role: string; type: "role-changed" },
        ) => void

      Returns void

    • Returns Promise<
          {
              iceServers?: {
                  credential?: string;
                  urls: string
                  | string[];
                  username?: string;
              }[];
              localRole?: string;
              peerId: string;
              peerMetadata?: Record<string, Record<string, string>>;
              peerRoles?: Record<string, string>;
              peers: string[];
              roomId: string;
              type: "room-joined";
              v?: number;
          },
      >