WebSockets
WebSockets & Market Streams
Low-latency streaming market data, order book updates, and real-time execution channels.
Depa provides a bidirectional WebSocket gateway for real-time market data, level-2 order book depth, and low-latency order placement.
1. Connection & Endpoints
| Environment | URL |
|---|---|
| Sandbox | wss://ws.sandbox.depasify.com/v1 |
| Production | wss://ws.depasify.com/v1 |
2. Authentication
Immediately upon establishing the TCP handshake, send an authentication message containing your JWT token:
{
"action": "authenticate",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}Confirmation
{
"event": "authenticated",
"status": "ok",
"user_uuid": "7de89d62-160b-4d12-a7b1-d3b3ac82c910"
}3. Subscribing to Order Book Depth
Subscribe to real-time bids and asks for any supported currency or stablecoin pair:
{
"action": "subscribe",
"channel": "order_book",
"pair": "EUR/USDC"
}Streaming Snapshot
{
"channel": "order_book",
"pair": "EUR/USDC",
"bids": [
["1.0841", "50000.00"],
["1.0840", "120000.00"],
["1.0838", "250000.00"]
],
"asks": [
["1.0843", "45000.00"],
["1.0845", "100000.00"],
["1.0848", "300000.00"]
],
"timestamp": 1714562400
}4. Heartbeats & Connection Maintenance
Clients should send a ping frame every 30 seconds to maintain the socket through intermediate NAT gateways:
{ "action": "ping" }Depa responds with:
{ "event": "pong" }