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

    Server-side SFU control handler. Turns a validated SfuRequest into the matching MediaRouter call and returns the SfuResponse to send back to the peer — so integrators wire one line into their signaling instead of hand-rolling the caps→transport→connect→produce→consume→resume protocol.

    Ownership is enforced by MediaRouter (a peer can only touch its own transports); malformed requests and mediasoup validation failures come back as { type: 'sfu-error' } rather than throwing.

    const router = await mediaService.attachRoom(room)
    const sfu = new SfuSignalHandler(router)
    // wire to your signaling: on an inbound SFU message from `peerId`,
    room.onSfu(async (peerId, msg) => room.send(peerId, await sfu.handle(peerId, msg)))
    Index

    Constructors

    Methods

    Constructors

    Methods

    • Validate and dispatch one inbound SFU request from a peer.

      Parameters

      • peerId: string

        Id of the requesting peer (used for transport ownership).

      • raw: unknown

        The raw inbound message; validated against SfuRequestSchema.

      Returns Promise<SfuResponse>

      The response to send back to the peer.