WebRTC Validation
Audience: contributors.
This checklist validates EP-02 #011 / #012 acceptance behavior for transport: 'webrtc':
- two-peer connection across machines
- STUN default and override behavior
- ICE gather default timeout (
5000ms) and explicit timeout validation - DataChannel defaults (
ordered: true, reliable by default) - connect-time BroadcastChannel fallback when signaling is unavailable on the same origin
- room lifecycle events (
connected,peer:join,peer:leave,disconnected,error)
1) Start Relay Signaling Server
Section titled “1) Start Relay Signaling Server”From repo root:
pnpm installpnpm --filter @roomful/relay buildpnpm --filter @roomful/relay startDefault address: ws://127.0.0.1:8787.
Optional relay env overrides:
HOST=0.0.0.0 PORT=8787 MAX_CONNECTIONS=1000 pnpm --filter @roomful/relay startcurl http://127.0.0.1:8787/healthFor cross-machine validation, use a reachable host/IP:
- Local machine relay example:
ws://<host-lan-ip>:8787 - Cloud relay example:
wss://relay.example.com
2) Configure Two Clients (Two Machines)
Section titled “2) Configure Two Clients (Two Machines)”Open the same app build on machine A and machine B (different networks allowed).
Configure both clients with:
const room = createRoom('validation-room-1', { transport: 'webrtc', relayUrl: 'ws://<reachable-relay-host>:8787', webrtc: { // defaults shown explicitly for validation clarity iceGatherTimeoutMs: 5000, dataChannel: { ordered: true, protocol: 'roomful-v1', // no maxRetransmits => reliable default }, },});Default behavior if omitted:
stunUrls: uses Google public STUN (stun:stun.l.google.com:19302)webrtc.iceGatherTimeoutMs:5000webrtc.dataChannel.ordered:truewebrtc.dataChannel.maxRetransmits: unset (reliable)
3) Two-Machine Event Sequence Checklist
Section titled “3) Two-Machine Event Sequence Checklist”- Connect machine A room instance.
- Connect machine B room instance.
- Expected:
- both emit
connected - both observe
peer:join peerCountincrements to1on each side
- both emit
- Send event payload from A to B (
room.useEvents().emit(...)), verify receipt on B. - Send event payload from B to A, verify receipt on A.
- Close machine B tab/app.
- Expected on A:
peer:leaveemitted for BpeerCountdecrements
- If signaling disconnects while connected, expected on both affected clients:
- room emits
disconnectedwith reason - room status transitions to
disconnected
- room emits
4) BroadcastChannel Fallback Verification
Section titled “4) BroadcastChannel Fallback Verification”- Open two clients on the same origin (for example, two tabs of the same local app build).
- Configure both clients with
transport: 'webrtc'and an unreachablerelayUrlvalue. - Keep
BroadcastChannelavailable in the runtime. - Expected:
- both clients still emit
connected - both observe
peer:join - event payloads still flow between the two tabs
- both clients still emit
- Confirm this is same-origin only:
- cross-machine peers should not connect in this fallback mode
- if
BroadcastChannelis unavailable, the connect attempt should fail instead of silently downgrading
5) ICE Timeout Verification
Section titled “5) ICE Timeout Verification”- Temporarily set
webrtc.iceGatherTimeoutMsto a low value (for example25). - Induce a gather timeout condition in the test environment/network.
- Expected:
- transport error path is triggered
- room emits
error
- Reset timeout to default (
5000) after validation.
6) maxPeers Verification
Section titled “6) maxPeers Verification”- Configure
maxPeersto a small value (for example2total peers including self). - Attempt to join additional peers.
- Expected:
- no new peer connection contexts created beyond limit
- existing peers continue to function