← All demos

Connection monitoring

Join a room and watch what the SDK reports: its events, the vdo.connections map, the streams it has seen (vdo.getStreams()), and vdo.state.

  1. Connect to the room in the URL.
  2. Publish your camera (optional) so another tab has something to view.
  3. Open a second tab with the share link, connect there, and click View on a stream.
  4. Watch both logs. Each side logs peerConnected; disconnect one tab and the other logs peerDisconnected.

Controls

Not connected

Not publishing.

Active connections

vdo.connections

Not connected

Streams seen in the room

vdo.getStreams()

No room joined

Event log

SDK state

vdo.state
{}
Key SDK calls in this demo
const vdo = new VDONinjaSDK({ room, salt: 'vdo.ninja', debug: true });
vdo.addEventListener('listing', (e) => { /* once for the whole list, then once per stream */ });
vdo.addEventListener('peerConnected', (e) => console.log('peer up', e.detail.uuid));
vdo.addEventListener('peerDisconnected', (e) => console.log('peer gone', e.detail.uuid));

await vdo.connect();
await vdo.joinRoom({ room });
await vdo.publish(camera, { streamID });                    // optional
await vdo.view(otherStreamID, { audio: false, video: false }); // data-only peer link

console.log(vdo.connections, vdo.getStreams(), vdo.state);

await vdo.disconnect();
camera.getTracks().forEach((t) => t.stop());   // disconnect() leaves your camera on