Getting Started
For testing purposes this uses the jest node
environment, seems to fail with JSDOM, something to do with the Buffer object not behaving as expected. Should still work with webpack in proper config though
-
node-pre-gyp is not recognized...
npm i @mapbox/node-pre-gyp
Older peer
on mesh update ->
//1. initiate
// do this for every younger peer who doesnt know anything
for mesh.youngerPeers
WHERE other.signals.older[thisKey] = null
CREATE male peer
onSignal
this.signals.younger[otherKey] = data
//2. respond
// do this for every older peer who is calling
FOR EACH mesh.olderPeers
WHERE other.signals.younger[thisKey] ! null
CREATE femalePeer
femalePeer.signal(other.signals.younger)
onSignal
this.signals.older[otherKey] = data
//3. confirm
// do this for every younger peer who knows you
FOR EACH mesh.youngerPeers
WHERE other.signals.older[thisKey] != null
AND NOT this.peers[otherKey].hasSignaled
this.peers[otherKey].signal(other.signals[thisKey].data)