1

This works perfectly on my own computers server

var socket = io.connect('http://localhost:3000');
    socket.of(userid).on('email', function (data) {
      console.log("here")
});

however when I switch to heroku like

var socket = io.connect('http://staginggorkemnutrition.herokuapp.com');
    socket.of(userid).on('email', function (data) {
      console.log("here")
});

it seems like the event is never received, also I dont change anything on my server when I am changing from heroku to localhost

ps. I have this in my server, I know I have to add this for heroku global.io.configure(function () { global.io.set("transports", ["xhr-polling"]); global.io.set("polling duration", 10); });

and my server side code when I emit the message looks like looks like:

exports.getFake = function(req, res){
    global.io.of(global.id).emit('email' , email);    
}
s_curry_s
  • 3,332
  • 9
  • 32
  • 47

1 Answers1

0

Web socket is experimental on Heroku. Did you read this : https://devcenter.heroku.com/articles/heroku-labs-websockets ? You may want to read this too : heroku multiple dyno socket.io

Community
  • 1
  • 1
wiri
  • 91
  • 8