*/ public function broadcastOn(): array { return [ new PresenceChannel('room.'.$this->roomId), ]; } /** * 获取广播时的数据 * * @return array */ public function broadcastWith(): array { return [ 'username' => $this->username, 'message' => "用户 [{$this->username}] 已被踢出聊天室。", ]; } }