I tried running the CLI but it is not working. The messages are braodcasted but is not received by the subscriber. I am running both of them in localhost.
Also the sample code below is also not producing any results
Server
var SignalServer = require('signalhub/server');
var hub = require('signalhub');
SignalServer().listen(5000, function () {
console.log("SignalServer listening on 5000");
var c = hub('peerchat', ['http://localhost:5000']);
setInterval(function(){
c.broadcast('new_message', "hey i am here");
}, 1000);
c.subscribe('new_client').on('data', function(data){
console.log("new client!", data.id);
});
});
Client
var signalhub = require('signalhub');
var hub = signalhub('peerchat', ['http://localhost:5000']);
hub.broadcast('new_client',"hey !!!!");
hub.subscribe('new_message').on('data', function(data) {
console.log('new message', data)
})
I tried running the CLI but it is not working. The messages are braodcasted but is not received by the subscriber. I am running both of them in localhost.
Also the sample code below is also not producing any results
Server
Client