Connection
Connect to the Polymarket WebSocket endpoint:Subscribing to markets
Once connected, send a JSON message to subscribe usingcondition_id:
Unsubscribing
Message types
Price messages
Real-time price updates for subscribed markets:Orderbook messages
Real-time orderbook snapshots for subscribed markets:Trade messages
Real-time trade executions for subscribed markets:Full example
Important notes
- No authentication required for WebSocket connections
- Use
condition_id(Polymarket condition identifier) to subscribe - Messages are only sent for markets you have explicitly subscribed to
- Multiple markets can be subscribed in a single message
- Trades must be explicitly requested (not included in the default subscription)
- Orderbook updates are high-frequency — consider filtering client-side if needed

