Skip to content

Instantly share code, notes, and snippets.

@ngrinkevich
Last active November 3, 2017 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngrinkevich/d4038ea4f342ee26cc4a17d6581964ce to your computer and use it in GitHub Desktop.
Save ngrinkevich/d4038ea4f342ee26cc4a17d6581964ce to your computer and use it in GitHub Desktop.
createNode((err, node) => {
if (err) {
return console.log('Could not create the Node', err)
}
node.on('peer:discovery', (peerInfo) => {
const idStr = peerInfo.id.toB58String()
console.log('Discovered a peer:', idStr)
})
node.start((err) => {
if (err) {
return console.log('WebRTC not supported')
}
const idStr = node.peerInfo.id.toB58String()
console.log('Node ' + idStr + 'has just started');
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment