Last active
September 17, 2018 17:09
-
-
Save pfrazee/b8aed1825a4d00afe12d533d04b10cc4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const info = network.info(key) | |
// high level automated: | |
network.join(key, { | |
announce: true, // announce self and listen for connections | |
lookup: true // seek out peers and connect to them | |
}) | |
network.leave(key) | |
network.on('connection', function (socket) { | |
}) | |
// more manual: | |
var lookup = network.disc.lookup(key) | |
network.disc.lookupOne(key, function (peer) { | |
network.connect(peer, function (socket) { | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment