Ok I think I got it.
I found the following article: https://glueck.dev/blog/allowing-guests-to-join-laravel-echo-presence-channels-using-laravel-11
didn't work like that, since the Auth::hasUser() always said that there is no user, even if I was authenticated. But I got it working like so:
// channels.php
Broadcast::routes([
'middleware' => ['web', AuthenticateBroadcastGuests::class],
]);
// AuthenticateBroadcastGuests.php
public function handle(Request $request, Closure $next): Response
{
if (Auth::guard('web')->check()) {
return $next($request);
}
Auth::login(Account::make([
'id' => (int) str_replace('.', '', microtime(true)),
'uid' => (string) Str::ulid(),
]));
return $next($request);
}
And thats it (Well, there were some dependencies in my account model I had to add fallbacks to). Non-authenticated visitors now get a virtual account I can use in the authentication callbacks.
Easier than I initially thought but it would still be great if there was guest-presence support included.