diff --git a/src/WebSockets/Channels/PresenceChannel.php b/src/WebSockets/Channels/PresenceChannel.php index 479d365..a4de157 100644 --- a/src/WebSockets/Channels/PresenceChannel.php +++ b/src/WebSockets/Channels/PresenceChannel.php @@ -63,9 +63,9 @@ class PresenceChannel extends Channel { return [ 'presence' => [ - 'ids' => $this->getUserIds(), + 'ids' => $userIds = $this->getUserIds(), 'hash' => $this->getHash(), - 'count' => count($this->users), + 'count' => count($userIds), ], ]; } @@ -73,7 +73,7 @@ class PresenceChannel extends Channel public function toArray(): array { return array_merge(parent::toArray(), [ - 'user_count' => count($this->users), + 'user_count' => count($this->getUserIds()), ]); } @@ -83,7 +83,7 @@ class PresenceChannel extends Channel return (string) $channelData->user_id; }, $this->users); - return array_values($userIds); + return array_values(array_unique($userIds)); } /**