-
-
Save RandyMcMillan/3acc32cc6791c7e9a0e8532711fb3e04 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
| var hypercore = require('hypercore') | |
| var ram = require('random-access-memory') | |
| var feed = hypercore(ram) | |
| feed.append('hello world') |
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
| var swarm = require('webrtc-swarm') | |
| var signalhub = require('signalhub') | |
| feed.on('ready', function () { | |
| var hub = signalhub(feed.discoveryKey.toString('hex'), ['https://signalhub.mafintosh.com']) | |
| var sw = swarm(hub) | |
| sw.on('peer', function (peer, id) { | |
| console.log('connected to a new peer:', id) | |
| peer.pipe(feed.replicate({encrypt: false})).pipe(peer) | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment