Can I set up socket.io chat on heroku?

前端 未结 7 587
栀梦
栀梦 2021-02-01 16:46

I have a simple socket.io chat application which I\'ve uploaded to one of the new Heroku \'cedar\' stacks.

Now I almost have everything working but I\'ve hit one stumbli

7条回答
  •  春和景丽
    2021-02-01 17:05

    The correct way according the article on heroku is:

    io.configure(function () { 
      io.set("transports", ["xhr-polling"]); 
      io.set("polling duration", 10); 
    });
    socket = new io.Socket();
    

    This ensures that io.Socket won't try to use WebSockets.

提交回复
热议问题