-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reverb not connectable locally via WebSocket (404) #202
Comments
To confirm, have you cleared out the following
|
Correct - I blanked those out before sharing but they had pregenerated values. Actually, I think I found the issue in that it's hitting the 404 in vendor/laravel/reverb/src/Servers/Reverb/Http/Router.php:53 due to no matched routes?
So it never reaches that [2024-05-21 09:25:27] local.ERROR: Resource not found for URI: / {"uri":"/","host":"localhost","method":"GET"} Is this because it binds to specific routes that Echo/the Laravel frontend generates when interacting with web sockets? EDIT: Pretty sure this is it. channels.php is untouched:
And I have the root route predefined in web.php - or is it trying to grab web socket specific routes?
|
Ah, I have to do an app specific call, eg |
Hey @medero that's right. You need to tell the Reverb server which app you wish to connect to. |
https://beyondco.de/docs/laravel-websockets/advanced-usage/custom-websocket-handlers I'm also looking for a way to set up a similar classic access point. and I don’t understand how to connect an external frontend to a channel without ws://localhost/ws/chat:6001 wss://localhost/ws/chat:6001 and how to test it in postman |
'{"event": "pusher:subscribe", "data": {"channel": "test-c"}}' @POMXARK use this to subscribe first and then set broadcasts |
Reverb Version
v1.0.0-beta10
Laravel Version
11.7.0
PHP Version
8.3.7
Description
I tried creating a fresh laravel project to reproduce and upon starting reverb with the defaults (0.0.0.0:8080) it gives a 404 GET on Chrome/Firefox even overriding the host with 127.0.0.1 or such. Alternatively tried node with ipv4/ipv6 and those both reliably work and return a 101.
Even with the --debug flag to start reverb there's nothing in laravel logs. Artisan successfully starts and I can see the "Welcome" page on port 8000 (web port) so Laravel seems to work at a base level, just not reverb.
When reverb is not running, I get
NS_ERROR_CONNECTION_REFUSED
. With a bogus host, I getNS_ERROR_UNKNOWN_HOST
When reverb is running I get a 404, so it means it's still hitting Laravel.
Just to sanity check, .env has these values by default (cleared out app id, app key, app secret):
broadcasting.php:
And reverb.php has allowed origins set to *:
System details:
Steps To Reproduce
Laravel steps to reproduce:
composer create-project laravel/laravel test-websocket ^11.0
cd test-websocket
php artisan install:broadcasting
Would you like to install Laravel Reverb? [Yes]
Would you like to install and build the Node dependencies required for broadcasting? [Yes]
Before I run reverb:start, I check that 8080 isn't in use with
lsof -i :8080
php artisan reverb:start --debug
INFO Starting server on 0.0.0.0:8080 (localhost).
lsof -i :8080
reports that php is listening on a TCP 8080 port:php **PID** meder **FDVALUE** IPv4 **DEVICEID** 0t0 TCP *:http-alt (LISTEN)
In Chrome and Firefox:
I get:
In Firefox's network tab:
Working node alternative with ipv6 and ipv4:
Which lsof -i :8080 confirms node is listening on the 8080 TCP port:
node **PID** meder **FDVALUE** IPv6 **DEVICEID** 0t0 TCP *:http-alt (LISTEN)
I get a 101 response:
Shortly after seeing the lsof output I saw ipv4 php used and ipv6 node used, to which I matched node and it still works, via:
node **PID** meder **FDVALUE** IPv4 **DEVICEID** 0t0 TCP localhost:http-alt (LISTEN)
Screenshot:
Attempt specifying php artisan reverb:start --host=127.0.0.1 didn't work either
Creating a test controller for a 200 OK/green path worked
To rule out application wide 404 issues:
The text was updated successfully, but these errors were encountered: