我正在尝试了解如何在用户加入频道后捕获事件后端。我的意思是在对 Private 或 Presence 通道进行身份验证之后。
例如,在那之后:
Broadcast::channel('chat.{roomId}', function ($user, $roomId) {
if ($user->canJoinRoom($roomId)) {
return ['id' => $user->id, 'name' => $user->name];
}
});
成功进行,我希望有可能捕捉到一个事件以知道用户加入了频道(不仅仅是前端)。
关于如何处理它的任何提示?
参考:https ://laravel.com/docs/6.x/broadcasting#joining-presence-channels