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上进行实验。 你读过这个吗? 您可能也想阅读以下内容: