WebsocketService::resetAllTracking(), which the server runs at start,
forgot "ws_channel_connections" without a channel suffix, a key nothing
writes. The real lists, ws_channel_connections_<channel>, outlived a
restart or crash, and getChannelConnections() returned dead sockets until
the channel was tracked again. The ws_socket_auth_<socket> entries stayed
behind the same way.
resetAllTracking() now reads ws_active_channels and ws_socket_authed_users
before it forgets them and deletes the per-channel lists and per-socket
auth entries they name.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Introduced `helpers-and-testing.md` to document global helpers and WebsocketService class usage.
- Created `HandlerLifecycleTest.php` to test the full WebSocket handler lifecycle, including connection management, channel subscriptions, and message routing.
- Added `WebsocketServiceTest.php` to validate state tracking methods in WebsocketService, covering user authentication, channel tracking, and broadcast functionality.