Repository navigation
fix: preserve WebSocket error subscription context - #16
Merged
Merged
Conversation
poly-william
approved these changes
Oct 8, 2026
watashi
pushed a commit
to watashi/polymarket-us-python
that referenced
this pull request
Oct 12, 2026
…bution feat(orders): builder attribution
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.
Changes
Server error frames include
subscriptionType, but the SDK drops it when constructing the callback error. Preserve it as optionalWebSocketError.subscription_typeon both streams and add the field toWebSocketErrorMessage. Existing error text, request IDs and dispatch behavior stay unchanged.Document the optional context and set the patch version to 2.4.1.
Part of ISVBE-939. SDK follow-up to https://github.com/Polymarket/go-gateway-us/pull/2267; the ticket's broader marshaler work remains separate.
Testing
Checklist
pytest)ruff check .)mypy polymarket_us)Note
Low Risk
Backward-compatible additive metadata on WebSocket error handling; no changes to auth, trading APIs, or connection lifecycle.
Overview
WebSocket server error frames can include
subscriptionType, but the SDK previously dropped it when buildingWebSocketErrorfor theerrorcallback. This change forwards that field as an optionalsubscription_typeattribute (alongside existingrequest_id) on both markets and private streams, and extendsWebSocketErrorMessagetyping accordingly.Error message text, callback dispatch, and
reprbehavior stay the same when the server omits context. README notes the new optional fields; release is bumped to 2.4.1 with regression tests across streams and subscription-type variants.Reviewed by Cursor Bugbot for commit 6a52685. Bugbot is set up for automated code reviews on this repo. Configure here.