Laravel Forge - Node.js Websocket Timeout

邮差的信 提交于 2019-12-11 12:27:13

问题


I have a simple socket.io node server hosted on my laravel forge/digital ocean server. Everything is working find on my local machine using homestead, however I get the following error on production:

http://[IP]:[PORT]/socket.io/?EIO=3&transport=polling&t=LCPeh0O net::ERR_CONNECTION_TIMED_OUT

On the server I can see that the node server.js file is receiving messages from Laravel but the client can't connect for whatever reason.

Is this something to do with the setup of Nginx? The configuration is the default forge one.

Thanks for any help, much appreciated.


回答1:


For anyone facing this problem, the fix is to expose ports for SocketIO (6001) and Redis (6379). Go to network tab in forge and set new firewall rules (or do it manually if you are not using forge). After that everything works perfectly.



来源:https://stackoverflow.com/questions/35635174/laravel-forge-node-js-websocket-timeout

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!