-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathmain.js
27 lines (20 loc) · 858 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var WebTorrent = require("webtorrent");
var Bugout = require("bugout");
var wrtc = require("wrtc");
var wt = new WebTorrent({tracker: {wrtc: wrtc}});
var b = Bugout({wt: wt});
// b.on("announce", console.log.bind(console, "Announced:"));
b.on("connections", console.log.bind(console, "Connections:"));
b.on("seen", console.log.bind(console, "Seen:"));
b.on("rpc", console.log.bind(console, "RPC:"));
b.on("message", console.log.bind(console, "Message:"));
// respond to ping calls by sending back "pong"
b.register("ping", function(pk, args, cb) {
args["pong"] = true;
cb(args);
}, "Respond to ping with 'pong'.");
console.log("Connect to this Bugout instance:\n");
console.log("https://chr15m.github.io/bugout/#" + b.address() + "\n");
console.log("Address:", b.address());
console.log("Seed:", b.seed);
console.log("Announcing to trackers...");