Closed michaelnabil230 closed 7 months ago
The main problem with these events is that even if dispatching the event might not block the event loop, any IO work that you do in the event listeners certainly will. So introducing these events basically opens up the door to easily (without knowledge) block the event loop/websocket server.
Hi @mpociot Can you explain more, And from your point of view what is the correct way so that I can listen to an event?
Thanks for the PR @michaelnabil230. However, right now, we want to keep events to a minimum to prevent users from unintentionally blocking the server.
This PR introduces significant enhancements to events, providing developers with the capability to listen to a range of pivotal events, thereby facilitating more dynamic and interactive user experiences. Additionally, it's noteworthy that events do not block the event loop to close the connection, ensuring smooth operation and efficient resource management. Moreover, this PR assists developers in migrating from Soketi to Reverb, streamlining the transition process, and leveraging the enhanced event capabilities offered by Reverb. The following events are now accessible through this PR:
Events:
NewConnection:
ConnectionClosed:
ConnectionError:
SubscribedToChannel:
UnsubscribedFromChannel:
ServerStarted:
ServerStopped:
By incorporating these event functionalities, developers can unlock a myriad of possibilities for building dynamic, responsive, and engaging web applications. Whether it's real-time chat applications, live notifications, or collaborative features, this PR equips Laravel developers with the tools needed to craft immersive user experiences that keep users connected and informed in real-time.