Added documentation for connection groups

This commit is contained in:
Chris 2024-02-21 12:57:10 +01:00
parent c855fc177f
commit 065d96f90a

View File

@ -13,4 +13,6 @@ foreach ($websocket->getGroup() as $other) {
} }
``` ```
To remove a group from a connection, call `setGroup(null)`. To remove a group from a connection, pass `null` to `WebSocketConnection::setGroup()`.
The group will emit a `join` event (`WebSocketConnection::EVENT_JOIN`) when another member joins the group, and a `leave` event (`WebSocketConnection::EVENT_LEAVE`) when a member leaves. The events will be sent to the leaving member as well, so consider this in your logic.