feat(ws): add subscribe_all_market for single-receiver all-event stream#292
Open
yovanoc wants to merge 3 commits intoPolymarket:mainfrom
Open
feat(ws): add subscribe_all_market for single-receiver all-event stream#292yovanoc wants to merge 3 commits intoPolymarket:mainfrom
yovanoc wants to merge 3 commits intoPolymarket:mainfrom
Conversation
Adds Client::subscribe_all_market(asset_ids) that returns a Stream<Item = Result<WsMessage>> with ALL market event types (Book, PriceChange, LastTradePrice, TickSizeChange, BestBidAsk, NewMarket, MarketResolved) filtered by asset_id. Uses subscribe_market_with_options(ids, true) internally — one broadcast receiver instead of N per event type. Enables custom_feature_enabled on the connection. This avoids broadcast channel overflow when consumers need multiple event types: instead of 6 subscribe_* calls creating 6 receivers, one subscribe_all_market call creates 1 receiver.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
==========================================
+ Coverage 85.45% 85.47% +0.02%
==========================================
Files 32 32
Lines 5121 5129 +8
==========================================
+ Hits 4376 4384 +8
Misses 745 745
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Adds
Client::subscribe_all_market(asset_ids)— returnsStream<Item = Result<WsMessage>>with all market event types from a single broadcast receiver.Thin wrapper around
subscribe_market_with_options(ids, true). Enablescustom_feature_enabled.Problem: calling multiple
subscribe_*methods (orderbook + ltp + bba + tick_size + ...) creates N broadcast receivers on the same channel. Each gets a copy of every message. At 6+ receivers the broadcast overflows.Fix: one call, one receiver, all events. Consumer dispatches by variant.
Note
Medium Risk
Adds a new public subscription API that changes how consumers may multiplex market events; main risk is behavioral/compatibility issues around receiving and dispatching all
WsMessagevariants and ensuring thecustom_feature_enabledflag is set as expected.Overview
Adds
Client::subscribe_all_market(asset_ids)to return a singleStream<Item = Result<WsMessage>>for all market channel events, usingsubscribe_market_with_options(..., true)to enablecustom_feature_enabledand avoid multiple broadcast receivers.Extends websocket tests to assert the subscription request includes
"custom_feature_enabled":trueand that the unified stream can receive bothWsMessage::BookandWsMessage::BestBidAskevents.Written by Cursor Bugbot for commit 40c28e2. This will update automatically on new commits. Configure here.