Instantly share code, notes, and snippets.

Embed
What would you like to do?
Exchanging signaling info over WebRTC

Original description:

Basically it would work like a PEX message in BitTorrent except it would work with the 2 way handshake WebRTC requires.

Considering something like this

  1. Peer A and B are connected to each other
  2. Peer A in addition know about peer C
  3. Peer A sends an extension message to B saying he knows about C
  4. Peer B replies with signalling data which A forwards to C.
  5. Peer C replies back with the other part of the signalling handshake that A forwards back to B
  6. B and C are now directly connected using no centralised servers :)

My question is, what would be a good way to present this as an interface to the end user? It seems like the right interface might differ greatly depending on the appplication, e.g. whether the nodes are in a DHT or a mesh. My idea right now is a layer on top of webrtc-swarm that makes the swarm act like a signalhub.

@paulkernfeld

This comment has been minimized.

Show comment
Hide comment
@paulkernfeld

paulkernfeld Jan 29, 2016

@mafintosh here is a possible building block for a swarm-based signaling system. The idea is to make a webrtc-swarm present the same interface as a signalhub. That way, discovery information could be shared across the swarm.

Owner

paulkernfeld commented Jan 29, 2016

@mafintosh here is a possible building block for a swarm-based signaling system. The idea is to make a webrtc-swarm present the same interface as a signalhub. That way, discovery information could be shared across the swarm.

@mafintosh

This comment has been minimized.

Show comment
Hide comment
@mafintosh

mafintosh Jan 29, 2016

re interface. i think it would be fun to experiment with this using the new hypercore extension protocool

var webrtcSignals = extension(core)

webrtcSignals.on('peer', function (id, peer) {
   // peer is a new stream
})
webrtcSignals.findPeers(id)

mafintosh commented Jan 29, 2016

re interface. i think it would be fun to experiment with this using the new hypercore extension protocool

var webrtcSignals = extension(core)

webrtcSignals.on('peer', function (id, peer) {
   // peer is a new stream
})
webrtcSignals.findPeers(id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment