laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
1.02k stars 71 forks source link

[1.x] Fixes incorrect user_count on presence channels #129

Closed ArthurPatriot closed 4 months ago

ArthurPatriot commented 4 months ago

1. user_count on get channels request

$pusher->getChannels(['filter_by_prefix' => 'presence-', 'info' => 'user_count']); return wrong number for user_count.

If we check Pusher documentation we will see - user_count is number of distinct users currently subscribed to this channel (a single user may be subscribed many times, but will only count as one). So user_count must return only unique users count, not connections count.

2. users list on get presence users request

$pusher->getPresenceUsers('presence-channel-id'); return wrong list of users with duplicates for each connection. If we check Pusher documentation - fetch user IDs of user currently subscribed to a presence channel. Here must be only unique users, not connections.

Resolves #130