Skip to content

Instantly share code, notes, and snippets.

@lazorfuzz
Created December 13, 2018 13:24
Show Gist options
  • Select an option

  • Save lazorfuzz/67f6e40566c20bd73abc37083da53e95 to your computer and use it in GitHub Desktop.

Select an option

Save lazorfuzz/67f6e40566c20bd73abc37083da53e95 to your computer and use it in GitHub Desktop.
join = (webrtc) => webrtc.joinRoom('my-p2p-app-demo');
handleCreatedPeer = (webrtc, peer) => {
this.addChat(`Peer-${peer.id.substring(0, 5)} joined the room!`, ' ', true);
}
handlePeerData = (webrtc, type, payload, peer) => {
switch(type) {
case 'chat':
this.addChat(`Peer-${peer.id.substring(0, 5)}`, payload);
break;
default:
return;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment