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.
Example
constrouter = awaitmediaService.attachRoom(room) constsfu = newSfuSignalHandler(router) // wire to your signaling: on an inbound SFU message from `peerId`, room.onSfu(async (peerId, msg) =>room.send(peerId, awaitsfu.handle(peerId, msg)))
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.Example