Skip to main content

Subscribe

Subscribe to a channel to receive real-time updates.

Message Structure

Fields

  • type (required): Must be "subscribe";
  • channel (required): Channel type ("user", "market" or "event");
  • auth (required only for channel: "user"): User’s API key (X-Api-Key);
  • markets (required for channel: "market"): Array of market IDs;
  • events (required for channel: "event"): Array of event IDs;
  • filter (optional for channel: "market" and channel: "event"): Desired update type
    • "" or "all": All updates (default)
    • "orderbook": Only orderbook updates
    • "trades": Only trade updates

Examples

Subscribe to User Channel

Subscribe to Market Channel

Subscribe to Event Channel

Multiple Subscriptions

You can subscribe to multiple channels and multiple resources on the same WebSocket connection:

Unsubscribe

Cancel subscription to a channel to stop receiving updates.

Message Structure

Fields

  • type (required): Must be "unsubscribe";
  • channel (required): Channel type ("user", "market" or "event");
  • markets (required for channel: "market"): Array of market IDs to unsubscribe from;
  • events (required for channel: "event"): Array of event IDs to unsubscribe from.

Examples

Unsubscribe from User Channel

Unsubscribe from Specific Markets

Unsubscribe from Specific Events

Complete Example

Important Notes

  • Subscriptions Persist: Once subscribed, you will continue receiving updates until you unsubscribe or disconnect;
  • Multiple Subscriptions to Same Resource: You can subscribe to the same market/event multiple times without issues;
  • Partial Cancellation: For market and event channels, you can unsubscribe from specific resources without affecting others;
  • Reconnection: In case of reconnection, you will need to subscribe again to all desired channels.