Websocket Overview

Overview

Summary: The SPOT WebSocket API provides persistent, subscription-based data streams. Public channels provide market data such as tickers, order book depth, and recent trades, while private authenticated channels provide user-specific fills, order updates, and account asset changes.

Unlike the request-response model of the REST API, WebSocket establishes a persistent connection, allowing the server to actively push data to the client.

Use cases: Real-time market display, order status monitoring, account asset change notifications, and high-frequency trading data retrieval where low-latency streaming updates are required.

Connection Addresses

Provides the public and private WebSocket endpoints for SPOT subscriptions.

Public Channels (no authentication required)

Public channels do not require authentication and are used for market data such as tickers, order book depth, and trades.

wss://stream-api.osl.com/v2/ws/public

Private Channels (authentication required)

Private channels require login and are used for account-specific data such as fills, orders, and asset updates.

wss://stream-api.osl.com/v2/ws/private

Connection Parameters

ParameterDescription
Heartbeat interval30 seconds, recommended
Connection timeoutAutomatically disconnected if there is no data for 60 seconds
Connection limit100 connections per IP
Message sizeMaximum 1MB

Heartbeat

The client needs to send a heartbeat every 30 seconds to keep the connection active. If no subscription is made or no data is pushed by the server within 30 seconds after connection, the system will automatically disconnect.

  • Heartbeat request: ping
  • Heartbeat response: pong