← All demos

Shared clipboard

Type or paste on one device and the text appears on every other device that has the same link. It travels peer to peer over WebRTC data channels and is never stored on a server.

  1. Open the link on another device, or in a second tab.
  2. Type or paste text into either box.
  3. It syncs to every connected device as you type.

Clipboard

Connecting…
0 characters
How it works
  • Share the link above with your other devices, or with someone else.
  • Any text typed or pasted syncs automatically; the most recent edit wins.
  • All data is sent peer to peer. The signaling server only introduces the devices.
  • Handy for moving a URL, code, or a note between a phone and a computer.
Key SDK calls in this demo
const sdk = new VDONinjaSDK({ room, password: false });
await sdk.connect();
await sdk.announce({ streamID, room, label: 'shared_clipboard' }); // also joins the room

// The room listing names peers already here: view each one once, data only
sdk.addEventListener('listing', (e) => {
  for (const p of e.detail.list || []) {
    if (p.streamID === streamID || viewed.has(p.streamID)) continue;
    viewed.add(p.streamID);
    sdk.quickView({ streamID: p.streamID, audio: false, video: false });
  }
});

// Once a channel opens, offer our text (never an empty box); then send each edit
sdk.addEventListener('dataChannelOpen', (e) => {
  if (textarea.value) sdk.sendData({ type: 'clipboard-sync', content: textarea.value }, e.detail.uuid);
});
textarea.addEventListener('input', () => sdk.sendData({ type: 'clipboard-update', content: textarea.value }));