Can you return an array with multiple channels in the broadcastOn function?
And did you authorize the channel: https://laravel.com/docs/5.3/broadcasting#authorizing-channels
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a Redis + socket.io setup in which public channels work perfectly. Private channels, however, do not.
I have verified to the best of my ability that I am successfully subscribing to the private channel with Echo by:
As far as I can tell, I am successfully subscribed when I trigger the event to be broadcast.
For my tests, I am broadcasting on a public channel as well as my private channel, and using toastr to display the notifications:
// MyEvent's broadcastOn method
public function broadcastOn()
{
return [
new Channel('my-public-test'),
new PrivateChannel('user.77'),
];
}
// javascript
Echo.private('user.77')
.listen('MyEvent', (event) => {
toastr['success']('private channel event received');
})
;
// PUBLIC CHANNELS
Echo.channel('my-public-test')
.listen('MyEvent', (event) => {
toastr['warning']('public channel event received');
})
;
When I trigger the event, only the public channel notification shows up. I have also removed the public listener in case there's a weird race condition in play.
I'm sure I've left out a detail that someone will ask about, so ask away, and I'll answer as well as I can.
If anyone has any idea why my private channel broadcast isn't being received, I'm all ears.
I got it to work (my queue wasn't flushing properly). Disclaimer for the following, I'm using a docker setup so some things might be 'exotic'.
If it is of any help, this is my configuration file for the laravel-echo-server:
{
"appKey": {{SECRET}},
"authHost": "http://web:8000",
"authEndpoint": "/broadcasting/auth",
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "redis"
}
},
"devMode": true,
"host": "0.0.0.0",
"port": "6001",
"referrers": [],
"socketio": {},
"sslCertPath": "",
"sslKeyPath": ""
}
This is my Echo client-side initialization:
import Echo from "laravel-echo"
window.Echo = new Echo({
namespace: 'MyApp.Events',// !warning . -> \\ conversion
broadcaster: 'socket.io',
host: Laravel.baseUrl + ':6001' //personal addition for docker
});
What type of authentication middle ware is your app primarily using?
Please or to participate in this conversation.