United Market is now live on BNB Smart Chain mainnet. We just launched — start trading on-chain prediction markets today.
Socket.IO (recommended)
Use a Socket.IO client — not a plain WebSocket client — to connect tohttps://api.unitedmarket.ai. The transport upgrades to a secure WebSocket (wss://) automatically.
Install Client
Connect
Subscribe to a Market
Join a market room with the marketconditionId.
Client Events
Server Events
orderbook:update
GET /markets/{id}/orderbook or GET /markets/{id}/trading.
trade:new
ob:snapshot
L2 levels are 18-decimal fixed-point strings — divide price and size by 1e18. When synthAsks is true, asks already include complement synthetic asks, so do not re-derive them client-side.
price:snapshot
Reconnection
Socket.IO reconnects automatically when configured withreconnection: true. Re-emit join:market subscriptions after reconnecting if your client manages rooms outside a persistent component.
Direct WebSocket (CLOB)
Advanced and server-side clients can connect straight to the CLOB matcher’s raw WebSocket. This is a lower-level feed: it streams the matcher’s native events without the backend’s room management, price snapshots, or payload normalization.Connect & Subscribe
Send a JSONsubscribe message with a market conditionId. The server replies with a subscribed acknowledgement, then streams that market’s events. Subscribe to multiple markets by sending multiple messages; remove one with unsubscribe.
If you never send a
subscribe message, the socket receives events for all markets. Send at least one subscribe to scope the stream to the markets you care about.Event Format
Every market event shares one envelope. The event name uses the matcher’s native form (ob_snapshot / ob_diff with underscores, and order:*), and the per-event detail lives under data.
ob_snapshot, data carries the full L2 book. As with the Socket.IO API, price and size are 18-decimal fixed-point strings, and synthAsks: true means asks already include complement synthetic asks.
