beyondcode / laravel-websockets

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

How to access the Dashboard in production with reverse proxy subdomain nginx? #269

Closed pmochine closed 5 years ago

pmochine commented 5 years ago

Hey,

so I successfully added the websocket to my vps. But now I want to see the dashboard but I cannot connect, because the url to the websocket is wrong.

Current: pusher.min.js:8 WebSocket connection to 'wss://staging.mywebsite.com:6001/app/<somenumber>?protocol=7&client=js&version=4.3.1&flash=false' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT

But it should be wss://socket.mywebsite.com:443

How could I change the path for the dashboard?

pmochine commented 5 years ago

How I see the config file has changed! Now there is a path and even a port option! I try this tomorrow out and if it works I close this issue.

pmochine commented 5 years ago

Okay it took me a while and needed to check how the dashboard is getting the data.

Path does not work, it's for something else. You need to add a host path. For example:

websockets.php

'apps' => [
        [
            'id' => env('PUSHER_APP_ID'),
            'name' => env('APP_NAME'),
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'host' => env('LARAVEL_WEBSOCKETS_HOST'),
            'capacity' => null,
            'enable_client_messages' => false,
            'enable_statistics' => true,
        ],
    ],

Then in your env file:

LARAVEL_WEBSOCKETS_HOST=socket.mydomain.com

Now it works perfectly.

namumakwembo commented 1 year ago

Thanks alot , this absolutely worked!