laravel-websockets
laravel-websockets copied to clipboard
add possibility to set base url for websocket-server
Hey Guys,
could you add a possibility to set the base url on the websocket-server?
Actually its not possible to configure a websocket server behind a sub-url like (https://beyondco.de/docs/laravel-websockets/basic-usage/ssl#same-location-for-websockets-and-web-contents):
location /ws { ... }
By configuring a websocket server at http://example.com/ws the route configuration does not match anymore in:
BeyondCode\LaravelWebSockets\Server\Router::echo(), so the websocket-server will permanently return 404 http status codes.
I agree. Btw any ideas how to solve this now apart from proxy-server?
Using v2.0 beta 36
We can add
WebSocketsRouter::addCustomRoute('GET', '/ws', \BeyondCode\LaravelWebSockets\Server\WebSocketHandler::class);
and set
PUSHER_APP_PATH: 'ws'
LARAVEL_WEBSOCKETS_PORT: '80'
(my env is yaml for helm k8s)
though it still does not work
I.e.: Me and N3XT0R want http://example.com/ws to be a websocket endpoint. Same domain as our websites. Same port as our websites but certain route.
@drmax24 You saved my day.
But how to get echo/pusher to use the path prefix as well? I couldn't find an option to set the path for the client