-1

I decided to use the Laravel Websockets in my projects, which downloading and testing the package locally does the work, but when I tried to deploy my Laravel Websocket application to the remote server (AWS EC2) for Production purpose the websocket dashboard won't connect and says Channels current state is unavailable I also get pusher error in the console :

WebSocket connection to 'wss://mydomain.com:6001/app/11236shfDs6pFJ5udC5P23a?protocol=7&client=js&version=4.4.0&flash=false' failed:

I have been researching the web and online forums to find a solution and debug this issue but unfortunately, I wasn't successful.

I double checked my configuration files, ssl certificates, env and .......

Please help me out with this issue to troubleshoot the problem.

I tried to setup Reverse Proxy for it but I'm not familiar with these configs and I'm not sure if I set it right :

<IfModule mod_ssl.c>
<VirtualHost *:443>
    ServerAdmin admin@mydomain.net
    ServerName socket.mydomain.net
    ServerAlias socket.mydomain.net
    ServerAlias www.socket.mydomain.net

    RewriteEngine On
    ProxyPreserveHost On
    ProxyRequests Off
    RewriteCond %{HTTP:Upgrade} =websocket [NC]
    RewriteRule ^/ws/(.*)       wss://127.0.0.1:6001/$1 [P,L]
    RewriteCond %{HTTP:Upgrade} !=websocket [NC]
    ProxyPassReverse / http://127.0.0.1:6001/

    DocumentRoot /var/www/html/websocket/public

    <Directory "/var/www/html/websocket">
        AllowOverride all
        Require all granted
    </Directory>
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/socket.mydomain.net/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/socket.mydomain.net/privkey.pem
</VirtualHost>
</IfModule>

1 Answers1

0

There are no configuration files and it's even unclear which web-server it is.

You cannot run WSS protocol on port 6001, externally that's always port 443.
When WS should be running on 6001, you'd have to setup reverse proxy for it.

It can be used as Pusher Replacement, since it also depends on Ratchet.
When struggling with the reverse proxy, Pusher may be easier to set up.
This would at least be an example for ngnix, to demonstrate what I mean.

Martin Zeitler
  • 1
  • 19
  • 155
  • 216