Closed hello-smile6 closed 2 years ago
I'll just pass a WebTorrent() instance to all of my Bugout instances.
Register your RPC:
b.register("ping", function(address, args, cb) {
args["pong"] = Math.random(); // this is the RPC action
cb(args);
});
Create a listener for your RPC:
b.on("rpc", function(address, call, args) {
console.log("rpc:", address, call, args);
});
I am making a P2P social media app and want to use RPC calls to retrieve data. Should I connect to the peer address, or is there another way?