Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pudd1nG's avatar

Laravel Echo - Allow guests to connect to presence channel

I am using laravel-echo-server to run Laravel Echo to broadcast events.

I have a user counter channel which shows all the users on the app. For this I am using a presence channel. This works fine for logged in users, but guests just never get connected.

I've setup the below in the BroadcastServiceProvider:

Broadcast::channel('global', function () { return ['name' => 'guest']; });

Which from what I can tell, should allow everyone in as 'guests'. I'm guessing there's some middleware or auth that's being checked before this that I need to disable for this channel.

Any help on getting all clients joining this presence channel would be much appreciated!

0 likes
3 replies
ultrabold's avatar

i finally managed to get it to work:

i often read about returning 'global' or some stuff when the /broadcasting/auth route gets called. What i really was missing the whole time was that i had to return something like this.

Route::post('/broadcasting/auth', function (Illuminate\Http\Request $req) { if ($req->channel_name == 'presence-global') { return Broadcast::auth($req); }

This produces the response pusher-js / laravel-echo expects for the guests to join a presence channel.

Hope that helps

1 like
s3nior's avatar

Is there another possibility, to achieve that? I only want to allow guests for a specific channel. Not for all PresenceChannels

Please or to participate in this conversation.