Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI not working #11

Closed
hackerkid opened this issue Sep 9, 2015 · 1 comment · Fixed by #13
Closed

CLI not working #11

hackerkid opened this issue Sep 9, 2015 · 1 comment · Fixed by #13

Comments

@hackerkid
Copy link

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)
})
@mafintosh
Copy link
Owner

Should be fixed in the latest version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants