laravel / reverb

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

Events #226

Closed d0m4te closed 3 months ago

github-actions[bot] commented 3 months ago

Thanks for submitting a PR!

In order to review and merge PRs most efficiently, we require that all PRs grant maintainer edit access before we review them. For information on how to do this, see the relevant GitHub documentation. Additionally, GitHub doesn't allow maintainer permissions from organization accounts. Please resubmit this PR from a personal GitHub account with maintainer permissions enabled.

LAGGOUNE-Walid commented 3 months ago

@d0m4te , @michaelnabil230 I was thinking to build the same logic (events for connection and disconnection) , but thinking for a sec , i realized there is serious issue and disadvantage (if connections number is big) with this events: ConnectionClosed also NewConnection . Think of this scenario : There is thousands or even millions of connections connected to reverb server, there are cases when all connections start reconnecting at the same time. Even if ConnectionClosed/NewConnection events were queued, there could be situations when the listeners for this events handle the disconnect hook (event) after user already reconnected ! and then mark this user as disconnected but in realty the user is reconnected (connected).