Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 带Heroku的Socket.io_Javascript_Heroku_Socket.io - Fatal编程技术网

Javascript 带Heroku的Socket.io

Javascript 带Heroku的Socket.io,javascript,heroku,socket.io,Javascript,Heroku,Socket.io,这在我自己的计算机服务器上非常有效 var socket = io.connect('http://localhost:3000'); socket.of(userid).on('email', function (data) { console.log("here") }); 但是当我换成heroku的时候 var socket = io.connect('http://staginggorkemnutrition.herokuapp.com'); socket.

这在我自己的计算机服务器上非常有效

var socket = io.connect('http://localhost:3000');
    socket.of(userid).on('email', function (data) {
      console.log("here")
});
但是当我换成heroku的时候

var socket = io.connect('http://staginggorkemnutrition.herokuapp.com');
    socket.of(userid).on('email', function (data) {
      console.log("here")
});
似乎从未收到该事件,而且当我从heroku更改为localhost时,我不会更改服务器上的任何内容

附言。 我的服务器中有这个,我知道我必须为heroku添加这个 configure(函数(){ global.io.set(“transports”,[“xhr polling”]); global.io.set(“轮询持续时间”,10); });

当我发出消息时,我的服务器端代码如下所示:

exports.getFake = function(req, res){
    global.io.of(global.id).emit('email' , email);    
}

Web套接字正在Heroku上进行实验。 你读过这个吗? 您可能也想阅读以下内容: