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/publicPrivate 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/privateConnection Parameters
| Parameter | Description |
|---|---|
| Heartbeat interval | 30 seconds, recommended |
| Connection timeout | Automatically disconnected if there is no data for 60 seconds |
| Connection limit | 100 connections per IP |
| Message size | Maximum 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