Multiplex WebSocket (subscribe / unsubscribe)
Establish a WebSocket connection and manage dynamic subscriptions to multiple realtime streams.
1. Endpoint & Authentication
WebSocket URL (EU):
wss://api.hypedexer.com/ws/ws
Include your API key as a header during the handshake:
X-API-Key: <your_api_key>
2. Protocol overview
All client messages are JSON objects with a method and a subscription:
method∈"subscribe","unsubscribe","list_subscriptions"subscriptionis an object describing the stream to manage
Methods
subscribe→ start receiving a given streamunsubscribe→ stop receiving a given streamlist_subscriptions→ get the list of active subscriptions for this connection
The server sends control frames for management:
type: "subscription_added"type: "subscription_removed"type: "subscriptions_list"
And data frames for each stream:
type: "completed_trades"type: "fills_spot"type: "recent_activity"type: "liquidation"
3. Available subscription types
All subscriptions are expressed via subscription.type:
completed_trades— all recent completed trades (optionally filtered byuser)fills_spot— spot fills streamrecent_activity— combined recent fills and tradesliquidation— liquidation events (optional filters:user,amount_dollars)
Each type has its own dedicated documentation page in the WebSocket section of the docs, with detailed examples and use-cases.
4. Client messages (examples)
Subscribe: all completed trades
{
"method": "subscribe",
"subscription": { "type": "completed_trades" }
}
Subscribe: completed trades for a specific user
{
"method": "subscribe",
"subscription": {
"type": "completed_trades",
"user": "0x8fcc8f55d7a8cdaee770a9e4112725d4a2c60492"
}
}
Subscribe: spot fills
{
"method": "subscribe",
"subscription": { "type": "fills_spot" }
}
Subscribe: recent activity (trades + fills)
{
"method": "subscribe",
"subscription": { "type": "recent_activity" }
}
Subscribe: liquidations (filtered by notional)
{
"method": "subscribe",
"subscription": {
"type": "liquidation",
"amount_dollars": 50000
}
}
Subscribe: liquidations (filtered by user)
{
"method": "subscribe",
"subscription": {
"type": "liquidation",
"user": "0x8fcc8f55d7a8cdaee770a9e4112725d4a2c60492"
}
}
Unsubscribe
{
"method": "unsubscribe",
"subscription": { "type": "completed_trades" }
}
The server then sends JSON frames with a type and payload data for each stream (see the dedicated pages for detailed payload shapes).