Repository navigation
feat: add user stream Websocket into C++ SDK - #25
Conversation
|
Hello Sebastian, I am interested in contributing to your Polymarket V2 C++ SDK. What I add so far is a user-stream websocket connection, it passes with real polymarket creds. Looking forward to hear from you. @SebastianBoehler |
|
Hi Bill, thanks for reaching out by email and for opening this PR! Contributions are very welcome, and I appreciate you adding this one! |
|
Thanks again for the contribution. I reviewed
Two smaller points: please split the larger new files where practical; I aim for roughly 300 lines per file. Also, is there a supported producer for the additional Does this match what you observed in your live testing? If you intended different behavior, I'd like to hear your reasoning. Could you implement these changes and the regression tests? I can then review the update. My additional checks used local servers; I did not independently test real Polymarket credentials. |
…r the subscription is restored, keeping on_stream_gap for immediate invalidation
…andshake can's connect with delivery disabled
…stead of disconnecting
… keep only the CLOB wire format
|
@SebastianBoehler Thanks for replying, all issues you mentioned are fixed, I also split the gaint files smaller and remove the topic/payloaded path. All changes passes the testcases and pass against the real server. Let me know if there still exists any issues. |
|
Hello Sebastian,
I fixed all issues you mentioned, I also splited the giant files into
smaller one and remove the topic/payload parse path. All changes passes
testcases and real server. Since Geographic Restriction I can't test or try
the order-related SDK from USA, so maybe there still exists some problems I
can't find out. If there are still exist any issues, please let me know.
Moreover, if you want, we can use Discord and github PR comment to connect.
Best,
Bill
Sebastian Boehler ***@***.***>
… *SebastianBoehler* left a comment
(SebastianBoehler/polymarket-cpp-client#25)
<#25 (comment)>
Thanks again for the contribution. I reviewed 868e9c1 and built the
user-stream example and relevant test targets. All 14 selected tests
passed. Some additional local probes exposed lifecycle cases that I think
we should address before merging:
1.
*Reconciliation runs before the subscription is restored.* In
handle_stream_gap()
<https://github.com/yluoc/polymarket-cpp-client/blob/868e9c1a34fd2262a2d2ca69a434b31eaf5b63aa/src/user_stream_runtime.cpp#L267-L274>,
the callback runs synchronously. On reconnect, the transport invokes it
before sending the authenticated subscription. A REST refresh inside that
callback can therefore miss changes between the refresh and subscription
activation. Polymarket does not replay missed events
<https://docs.polymarket.com/trading/realtime-order-updates#recover-after-reconnecting>.
Please arrange recovery so consumers reconcile after subscription
restoration, while retaining immediate gap notification to invalidate stale
state. A test should check that ordering.
2.
*A connection timeout leaves the socket running but disables event
delivery.* connect()
<https://github.com/yluoc/polymarket-cpp-client/blob/868e9c1a34fd2262a2d2ca69a434b31eaf5b63aa/src/user_stream_runtime.cpp#L220-L230>
deactivates the stream without stopping the transport. With a delayed
handshake, I reproduced connect() returning false, followed by
is_connected() becoming true while a valid order event was silently
dropped. Please stop the transport when returning failure and add a
delayed-handshake regression test.
3.
*Terminal authentication rejection does not end run().* The rejection
handler
<https://github.com/yluoc/polymarket-cpp-client/blob/868e9c1a34fd2262a2d2ca69a434b31eaf5b63aa/src/user_stream_runtime.cpp#L277-L291>
disconnects the socket, but the blocking loop waits for stop(). I
reproduced rejection with close code 1008 while run() remained
blocked. I'd expect terminal rejection to end that loop. Please cover
rejection both during run() and before entering it.
Two smaller points: please split the larger new files where practical; I
aim for roughly 300 lines per file. Also, is there a supported producer for
the additional topic/type/payload parsing path? If not, please keep the
parser focused on the actual wire format.
Does this match what you observed in your live testing? If you intended
different behavior, I'd like to hear your reasoning. Could you implement
these changes and the regression tests? I can then review the update. My
additional checks used local servers; I did not independently test real
Polymarket credentials.
—
Reply to this email directly, view it on GitHub
<#25?email_source=notifications&email_token=AXTESC63DNRGPAN3V2PRTQT5R7OVPA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTKOJVG42DOMJSGEYKM4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-5957471210>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXTESC674IQDZBR765BIWUT5R7OVPAVCNFSNUABGKJSXA33TNF2G64TZHMYTCMRWGY3TCNRUGQ5US43TOVSTWNJWGY4DMMZWGA2DTILWAI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Summary
Verification
Notes
New functionality passes all testcases and the live run against Polymarket's real user-channel server.