Hi,
I'm using the laravel-websockets package toghether with Laravel broadcasting and events. First I made a seperate event which implements the ShouldBroadcast intercace and contains a broadcastOn function which returns a public Channel. I use Vue + Echo library in order to receive the events which get broadcasted by the Laravel backend.
But after adding a seperate Event which get broadcasted through a PrivateChannel, I get the following error in my webbrowser conole:
app.js:68125 POST http://localhost:8000/broadcasting/auth 405 (Method Not Allowed)
I checked the existing routes with artisan route:list, but the list doesn't show anything like "broadcasting/auth". The only route which seems to get close is this one:
| POST | admin/websockets/event | BeyondCode\LaravelWebSockets\Dashboard\Http\Controllers\SendMessage |
I checked config\app.php for Illuminate\Broadcasting\BroadcastServiceProvider::class which is enabled. I have two event listeners in my bootstrap.js:
window.Echo.channel('DemoPublicChannel').listen('WebSocketDemoPublicEvent', (e) => {
console.log(e);
});
window.Echo.private('DemoPrivateChannel').listen('WebSocketDemoPrivateEvent', (e)=> {
console.log(e)
});
When commenting the private one, the HTTP 405 error disappears. The public message is printed in the console when broadcasted by the Laravel backend, the private message doesn't show up.
Do you have any idea where I can find the routes and why they aren't displayed in the artisan route:list output?
The channels.php authorization function just returns true, so I guess the user should be authorized to access the channel, and I use sanctum SPA authentication to authenticate.