Repository navigation
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
This was referenced Oct 24, 2026
Two things a long-running client needs were not possible: - Replacing one set of topics with another, removals first. The server enforces a per-connection subscription limit (it answers "Subscription limit reached for feed", which the client logs since massive-com#1039). The client always sends the subscribe message before the unsubscribe message, so a swap made at the limit asks for more topics than the limit allows before the unsubscribe arrives. - Sending a subscribe message again for a topic the server never acknowledged. subscribe() sends only topics missing from subs, so a topic already sent can never be sent twice. set_subscriptions(desired) replaces the scheduled topics in one step. The next update then sends one unsubscribe message for the removed topics, followed by one subscribe message for the added ones. resubscribe(*topics) adds topics to the next subscribe message. A topic that is neither subscribed nor scheduled raises ValueError, and then nothing is sent. subscribe(), unsubscribe() and unsubscribe_all() keep their order: subscribe first, then unsubscribe.
chipkent
force-pushed
the
feat/ws-immediate-subscriptions
branch
from
October 24, 2026 14:54
8247c09 to
0c0a16c
Compare
chipkent
force-pushed
the
feat/ws-set-subscriptions
branch
from
October 24, 2026 14:54
d847d8f to
6c8a38d
Compare
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #<issue: F1c>
Builds on #21.
Two new
WebSocketClientmethods, both safe to call from any thread whileconnect()runs:set_subscriptions(desired)replaces the wanted topics in one step. The client then sends one unsubscribe message for the removed topics, followed by one subscribe message for the added ones. Removals go first, so a swap made at the server's subscription limit ([SPT-1644] Log WebSocket server errors instead of dropping them massive-com/client-python#1039 logsSubscription limit reached for feed) never asks for more than the limit. Data that both a removed and an added topic cover (e.g.T.AAPLreplaced byT.*) is not delivered in between.resubscribe(*topics)sends a subscribe message again for topics the client already counts as subscribed, for example ones the server never acknowledged. A topic that is neither subscribed nor scheduled raisesValueError, and then nothing is sent.subscribe(),unsubscribe()andunsubscribe_all()keep their send order: subscribe first, then unsubscribe.Tests
test_set_subscriptions.pychecks the messages both methods send, and thatValueErrorsends nothing.make testandmake lintpass on 3.10 and 3.14.