beyondcode / laravel-websockets

Websockets for Laravel. Done right.
https://beyondco.de/docs/laravel-websockets
MIT License
5.08k stars 629 forks source link

Laravel Forge Configuration #51

Closed ulfie22 closed 5 years ago

ulfie22 commented 5 years ago

I have the websocket server running locally and a separate also-local laravel instance can connect to it - the debug console shows the events. This is super cool - thank you for making this!

I have created an AWS EC2 instance using Forge and deployed that repo. I did the migrations, registered, etc. The web portion of the Laravel install seems to be working fine. Using Forge, I opened port 6001. The debug console comes up (and it correctly shows the names of the two apps I configured). If I connect to one of them, some items come up on the graph, but it does not show the private websocket Channel events and my attempts to trigger events through it silently fail.

Is there more configuration I need to do on AWS and/or Forge?

Thanks

acacha commented 5 years ago

@ulfie22 Could you share your Laravel Forge Configuration?

Thanks

vesper8 commented 5 years ago

If everything is working fine except you're not seeing events and channels in your debug dashboard, then I believe this is the known bug with InvalidSignature that should be fixed soon once the PRs get approved.

If you look at your websocket output (either by running it manually or inspecting the stdout log from supervisor), don't you see InvalidSignature errors when attempting to connect to the debug dashboard channel?

ulfie22 commented 5 years ago

@acacha The Forge configuration is pretty vanilla. I made a new EC2 instance, added a new site to it, added my repo, edited the .env to match the new credentials. The only thing I did was to add a Firewall Rule to open port 6001 for WebSockets. I am not using an Nginx proxy (unless that is the default). Here is a gist of the config/websockets.php file:

https://gist.github.com/ulfie22/c84196c26de4809093b50e418b2fbf37

I did not do anything to the bootstrap.js file - I did not see anything in the docs to do so.

@vesper8 I am not sure what "websocket output" you are referring to. When I execute the serve command, i get Starting the WebSocket server on port 6001... and no further output.

If I inspect the debug console, I see in the inspect console this message: WebSocket connection to 'ws://socket.jump-on.it:6001/app/<the app id>?protocol=7&client=js&version=4.3.1&flash=false' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED.

It feels like somehow the port is just not open on the server (though Forge shows that it is).

Thank you for your help!!

stayallive commented 5 years ago

@ulfie22 it does look like port 6001 is not reachable on that host. It might be an EC2 security group firewall rule still blocking the connection to port 6001. Might want to double check, Forge might open it on the server but AWS might still be blocking it 😄

Looking at https://www.portcheckers.com/ the port is really closed.

ulfie22 commented 5 years ago

@stayallive Thanks for that link - it is super helpful!!

I switched over to Digital Ocean instance and got further - until I'm now stymied by the Invalid Signature error. I believe there is a PR to fix this due imminently

mpociot commented 5 years ago

The invalid signature error is now fixed in 1.0.3