From 065d96f90a9a270b27df6d7ed2c604dea3cdcc9c Mon Sep 17 00:00:00 2001 From: Christopher Vagnetoft Date: Wed, 21 Feb 2024 12:57:10 +0100 Subject: [PATCH] Added documentation for connection groups --- doc/ConnectionGroups.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/ConnectionGroups.md b/doc/ConnectionGroups.md index f9010d5..8d096af 100644 --- a/doc/ConnectionGroups.md +++ b/doc/ConnectionGroups.md @@ -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.