Skip to content

PolymarketExchangeOptions.websocket (PolymarketWebSocketConfig) not passable through either SDK #1052

Open

Description

@realfishsam

Gap

PolymarketExchangeOptions in core accepts an optional websocket?: PolymarketWebSocketConfig field that lets callers configure the underlying Polymarket WebSocket connection (URL overrides, channel settings, reconnect behavior, etc.). Neither the TypeScript SDK PolymarketOptions interface nor the Python SDK Polymarket.__init__ expose this field, so it is silently dropped and the sidecar always uses defaults.

Note: the same class of gap exists for Opinion (OpinionExchangeOptions.websocket, #973) and Probable (wsConfig, #972). This issue is specifically for Polymarket.

Core

core/src/exchanges/polymarket/index.ts

  • PolymarketExchangeOptions.websocket?: PolymarketWebSocketConfig — line 56
  • The config is read at line 80 and stored as this.wsConfig (line 88)
  • Used when ensureWs() constructs the PolymarketWebSocket instance at line 773

core/src/exchanges/polymarket/websocket.ts — defines PolymarketWebSocketConfig and WatcherConfig; both types are re-exported from the exchange index at line 51.

TypeScript SDK

sdks/typescript/pmxt/client.ts — PolymarketOptions interface (line 3023–3044):

export interface PolymarketOptions {
    apiKey?: string;
    privateKey?: string;
    pmxtApiKey?: string;
    baseUrl?: string;
    autoStartServer?: boolean;
    proxyAddress?: string;
    signatureType?: 'eoa' | 'poly-proxy' | 'gnosis-safe' | number;
    // websocket field is absent
}

The constructor (line 3047) passes options straight through to the sidecar as ExchangeOptions; there is no websocket key in the wire format.

Python SDK

sdks/python/pmxt/_exchanges.py — Polymarket.__init__ (line 13–56):

def __init__(
    self,
    api_key: Optional[str] = None,
    api_secret: Optional[str] = None,
    passphrase: Optional[str] = None,
    private_key: Optional[str] = None,
    proxy_address: Optional[str] = None,
    signature_type: Optional[str] = "gnosis-safe",
    base_url: Optional[str] = None,
    auto_start_server: Optional[bool] = None,
    pmxt_api_key: Optional[str] = None,
    wallet_address: Optional[str] = None,
    signer: Optional[object] = None,
    # websocket parameter absent
) -> None:

Evidence

Users who need to override the Polymarket WebSocket endpoint (e.g. pointing at a staging environment, adjusting reconnect timeouts, or subscribing to specific user-channel events) have no way to pass the config through the SDK:

// Desired — currently impossible in TypeScript SDK:
const poly = new pmxt.Polymarket({
    apiKey: "...",
    websocket: {
        wsUrl: "wss://custom-ws.example.com",
        reconnectInterval: 5000,
    },
});
# Desired — currently impossible in Python SDK:
poly = pmxt.Polymarket(
    api_key="...",
    websocket={"ws_url": "wss://custom-ws.example.com"},
)

Impact

SDK users cannot customize Polymarket WebSocket behavior. The sidecar always uses the hardcoded default WebSocket URL and settings. This blocks users who need staging-environment access, custom reconnect policies, or specific user-channel event filtering that PolymarketWebSocketConfig and WatcherConfig enable in core.

Activity

  1. added 9 commits that reference this issue on Jun 16, 2026
    4b8f210
    97e9833
    72dc168
    bcab4d4
    4ea3b1e
    d0bbf9a
    846e814
    01b84fd
    0bd4b6a
  2. added 4 commits that reference this issue on Jul 12, 2026
    503d34a
    f7860cb
    ac74438
    8d0b555
  3. realfishsam commented on Sep 5, 2026

    @realfishsam
    ContributorAuthor

    Additional context from duplicate #1759: PR #1126 ("feat(sdk): expose WebSocket configuration for Polymarket and Kalshi"), which is linked as closing this issue, does not actually fix it. It adds a same-named websocket option to both SDKs, but that option configures WsClientConfig (sdks/typescript/pmxt/ws-client.ts) — the local SDK↔sidecar transport socket — not core's PolymarketWebSocketConfig (core/src/exchanges/polymarket/websocket.ts:53-68, exposed as PolymarketExchangeOptions.websocket at core/src/exchanges/polymarket/index.ts:56). None of core's real field names (flushIntervalMs, watcherConfig, userChannelCreds, connectionTimeoutMs, snapshotFallbackMs) exist anywhere in either SDK, and core/src/server/exchange-factory.ts's createExchange() still takes no websocket-config parameter and passes none through at its new PolymarketExchange({...}) call site. This issue should remain open — please don't treat PR #1126 as resolving it.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions