Can I set up socket.io chat on heroku?

前端 未结 7 573
栀梦
栀梦 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条回答
  •  梦毁少年i
    2021-02-01 16:59

    This has now changed as of Oct 2013, heroku have added websocket support:

    https://devcenter.heroku.com/articles/node-websockets

    Use:

    heroku labs:enable websockets
    

    To enable websockets and dont forget to remove:

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

提交回复
热议问题