1.0.2 • Published 5 years ago
hp2p v1.0.2
Hosting Peer to Peer
GigaGamma Hosting's peer to peer solution.
Getting Started
To get started with hp2p, you'll need an hp2p broker and at least two hp2p clients.
Write the following code for the broker:
const hp2p = require("hp2p");
var h = new hp2p.Broker();
Write the following code for both clients:
const hp2p = require("hp2p");
var h = new hp2p.P2P("localhost", "test-channel");
h.onConnect = () => {
h.topo.on("connection", (conn, peer) => {
conn.on("data", data => {
console.log(data.toString());
});
conn.write("Hello");
});
}