问题
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