I have a working local environment using Laravel Valet to host a Laravel API and a Vite SPA which is authenticated using Laravel Sanctum. I have a Valet link for my Laravel API configured as api.mydomain.test
which points to my API and a proxy for my SPA as app.mydomain.test => http://localhost:5173
(the Vite server). This setup works and I am able to have both applications running on the same domain through Valet.
Now I am trying to configure Reverb as my broadcast connection. Trying to mimic the instructions here, I set up another valet proxy for ws.mydomain.test => http://localhost:8080
to point to the running reverb server (defaults to 0.0.0.0:8080
), and have my reverb environment variables as:
REVERB_HOST=ws.mydomain.test
REVERB_PORT=80
The Echo configuration on my frontend is also configured to connect to ws://ws.mydomain.test:80
and does appear to make a successful connection to the /app
websocket path (no errors in console/ws network tab).
The problem appears when actually trying to broadcast an event, I always get the following error:
local.ERROR: Pusher error: Not found.. {"exception":"[object] (Illuminate\Broadcasting\BroadcastException(code: 0): Pusher error: Not found.. at /Users/stetson/workspace/plip/api/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:167)
Digging deeper this appears to be a result of a 404 response from the request to http://ws.mydomain.test/apps//events?{list-of-params)
that the pusher-php-server
initiates.
As noted here in the disclaimer
Reverb listens for WebSocket connections at /app and handles API requests at /apps. You should ensure the web server handling Reverb requests can serve both of these URIs
Seems like it’s probably a configuration item I’m missing with Valet and my proxy isn’t pointing to the right place.