Commit Graph

23 Commits

Author SHA1 Message Date
Fabian @ Blax Software b066d75b33 BF reject private/presence subscribe with invalid signature
handleSubscription() recorded the socket in $channel_connections and in the
buffered ws_channel_connections_* / ws_active_channels cache before
$channel->subscribe() ran, and swallowed the InvalidSignature it threw. On
the same frame shouldRejectMessage() found the entry and called
saveConnection(), and the client got "websocket.subscribe:response Success".
One subscribe with a bad signature put the socket on the private or presence
channel, where it received broadcasts, and WebsocketService listed it.

- Track the socket only after subscribe() succeeds (or it is already on the
  channel).
- A failed private/presence subscribe answers "<event>:error" with the
  exception's message and code (Invalid Signature, 4009), drops any earlier
  tracking of the socket on that channel, takes it off the channel if the
  subscribe had already saved it, and ends the frame before
  shouldRejectMessage() and the Success reply.
- Public channels behave as before.

Tests assert, after the single subscribe frame, the error reply, no channel
membership, no $channel_connections entry and no cache listing, and that a
later message on the channel does not resubscribe the socket.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-04 11:56:38 +01:00
Fabian @ Blax Software 488f068140 C linting 2026-04-02 12:44:31 +02:00
Fabian @ Blax Software 093bbe3a44 A tests, documentation for helpers and lifecycle
- 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.
2026-04-02 12:44:16 +02:00
Blax Software 87bf0ae05e Pusher : -> . 2025-01-18 17:06:52 +01:00
Alexander Blasl 1a5db82c26 Renovation 2025-01-16 08:54:02 +01:00
Marcel Pociot fb958fb851
Merge 2.x changes (#1043)
* Resolve conflicts

* Apply fixes from StyleCI (#1042)
2022-10-06 13:46:54 +02:00
erikn69 0a8f7aa33e
Fix on tests (#895) 2021-12-17 16:42:26 +01:00
Alex Renoki cbe4378086 Revert "formatting"
This reverts commit 8308a7d16d.
2020-12-07 23:30:36 +02:00
Alex Renoki b6837a05e4 Revert "Apply fixes from StyleCI (#632)"
This reverts commit 908f147cb3.
2020-12-07 23:30:28 +02:00
Alex Renoki b74144cdd5 Revert "wip formatting"
This reverts commit 19ca49a4a8.
2020-12-07 23:30:12 +02:00
Alex Renoki 19ca49a4a8 wip formatting 2020-12-07 20:48:15 +02:00
rennokki 908f147cb3
Apply fixes from StyleCI (#632) 2020-12-07 19:37:03 +01:00
Alex Renoki 8308a7d16d formatting 2020-12-07 20:36:39 +02:00
rennokki a9f87dbf95
Apply fixes from StyleCI (#546) 2020-09-19 17:41:47 +02:00
Alex Renoki 53a6d0f875 Added tests 2020-09-19 18:41:25 +03:00
Alex Renoki 2066e803b8 Fixed tests to make sure the message is broadcasted properly both locally and across servers. 2020-09-18 21:01:11 +03:00
Alex Renoki ed41ad5ca0 Moved tests across classes 2020-09-18 12:53:36 +03:00
Alex Renoki 7365189aaa Fixed tests 2020-09-17 14:18:15 +03:00
Alex Renoki 16ff2aa2b6 Fixed uniqueness 2020-09-17 11:30:36 +03:00
Alex Renoki 97ab241fa3 Fixing PR #530 2020-09-16 11:02:58 +03:00
Alex Renoki b41f8b7b75 Creating SignedMessage class for testing 2020-09-15 20:46:19 +03:00
Alex Renoki ec47925c71 Added soft closes for connections on SIGTERM/SIGINT 2020-09-12 17:45:07 +03:00
Alex Renoki 6f32b89459 wip 2020-09-10 22:59:26 +03:00