I'm trying to push a node.js app to heroku.
我正在尝试将node.js应用程序推送到heroku。
The app has a http server listening on one port (process.env.PORT) but I also want a web socket using another port. Is this possible in heroku? I am using ws.js to do the sockets.
该应用程序有一个http服务器侦听一个端口(process.env.PORT),但我也想要一个使用另一个端口的Web套接字。这可能在heroku?我正在使用ws.js来做套接字。
On my local machine I can obviously use 3000 for one port and 8080 for the other, but I can't see how to define a second port that heroku will be happy to let me use.
在我的本地机器上,显然我可以使用3000作为一个端口而8080作为另一个端口,但我看不出如何定义heroku很乐意让我使用的第二个端口。
thanks
matt
2 个解决方案
#1
2
According to Heroku they don't yet support WebSockets: see this article. According to this SO question you can use socket.io (< v0.7) to do realtime stuff, but you can't use WebSockets, it'll fall back to XHR polling.
根据Heroku,他们还不支持WebSockets:请参阅此文章。根据这个SO问题,你可以使用socket.io(
#2
2
Heroku now supports websockets, as of 2013. For implementation have a look at the following article:
Heroku现在支持websockets,截至2013年。对于实现,请查看以下文章:
#1
2
According to Heroku they don't yet support WebSockets: see this article. According to this SO question you can use socket.io (< v0.7) to do realtime stuff, but you can't use WebSockets, it'll fall back to XHR polling.
根据Heroku,他们还不支持WebSockets:请参阅此文章。根据这个SO问题,你可以使用socket.io(
#2
2
Heroku now supports websockets, as of 2013. For implementation have a look at the following article:
Heroku现在支持websockets,截至2013年。对于实现,请查看以下文章: