This commit is contained in:
2020-08-21 16:54:15 -04:00
parent 5d1b3f2678
commit 164a972faa
6 changed files with 216 additions and 224 deletions

18
app.js
View File

@@ -1,6 +1,9 @@
#!/usr/bin/env nodejs
const app = {};
module.exports = app;
const {P2P} = require('./p2p')
const p2p = require('./peers')
const args = process.argv.slice(1);
@@ -18,13 +21,10 @@ if(server_port){
process.exit(0)
}
p2p.listen(server_port);
for(let client of clients_list){
p2p.addPeer(client);
}
app.p2p = new P2P({
listenPort: server_port,
peers: clients_list
})
setTimeout(function(){
p2p.broadcast({type:'topic', body:"yolo"})
}, 10000);
app.pubsub = require('./pubsub')