WebSocket
WebSocket is a protocol that enables real-time, two-way communication between client and server over a single persistent connection. It's essential for streaming market data.
Understanding the Concept
REST requires you to ask for data. WebSockets push data to you the moment it changes. For trading, this difference is everything.
With a WebSocket connection, you subscribe to channels (like "bitcoin trades" or "ethereum orderbook") and receive updates instantly. No polling, no wasted requests, no latency from repeated connections.
The tradeoff? Complexity. You need to handle connection management, reconnection logic, message parsing, and subscription state. But for real-time trading data, there's no alternative.
Real-World Example
You open a WebSocket connection to PRISM and subscribe to Bitcoin trades: {"action": "subscribe", "channel": "trades", "symbol": "bitcoin"}. Every trade that happens pushes to your connection instantly—no delay, no polling.
How PRISM Handles This
PRISM's WebSocket API supports real-time feeds for trades, orderbook updates, and price ticks. We handle reconnection gracefully with message replay for missed data. Subscribe to multiple assets over one connection to minimize resource usage.
View API Docs