Shared Core Live Guest Queue Tutorial
Build a headless guest queue with mediasfu-shared@1.1.0. Your application
renders waiting people and requests; shared core sends the published allow or
reject operations through the live room runtime.
Prerequisites
- Node.js 18 to 20 and a TypeScript application with a live room socket.
- A queue renderer and an authenticated backend that decides who may enter.
Project files
{"private":true,"type":"module","scripts":{"typecheck":"tsc --noEmit"},"dependencies":{"mediasfu-shared":"1.1.0","mediasoup-client":"3.20.0","socket.io-client":"4.8.3"},"devDependencies":{"typescript":"5.9.3"}}
{"compilerOptions":{"strict":true,"target":"ES2022","module":"ESNext","moduleResolution":"bundler","lib":["DOM","ES2022"],"skipLibCheck":true,"noEmit":true},"include":["src/**/*.ts"]}
import { respondToRequests, respondToWaiting } from 'mediasfu-shared';
export type GuestQueueRuntime={waiting:Parameters<typeof respondToWaiting>[0];request:Parameters<typeof respondToRequests>[0]};
export async function decideGuestEntry(runtime:GuestQueueRuntime){
await respondToWaiting(runtime.waiting);
await respondToRequests(runtime.request);
}
import type { GuestQueueRuntime } from './guest-queue';
export type QueueRenderer={renderWaiting():void;renderRequests():void;showFailure(message:string):void};
export type QueueApplication={runtime:GuestQueueRuntime;renderer:QueueRenderer;mayModerate:boolean};
The application fills the typed runtime from its active socket, and calls
decideGuestEntry only after its host-policy check succeeds.
Run
npm install
npm run typecheck
Expected result
With a live room runtime, choosing an allow or reject decision updates waiting and request state for the room. The renderer reflects the socket update rather than assuming entry succeeded immediately.
Recovery
Keep the guest pending when a decision fails or the host reconnects. Reload the queue before retrying, and announce entry only after the guest's room has opened.
Cleanup
Clear outstanding selections, unmount the queue, and close app-owned room resources when the moderator leaves. Shared core has no host-wide end operation.
Release boundary
An authenticated backend owns room entry and moderation authorization. Shared core does not render a queue or provide safe client-side hosted room creation; do not expose a MediaSFU Cloud credential to the browser.