---
updatedAt: 2026-09-08T08:45:49.000Z
agentTools:
  projectIndex: https://apidocs.bct.host/llms.txt
---

# Stream Subscription API

Stream Subscription API is a real-time data push service based on the WebSocket protocol. Unlike the request-response model of REST APIs, WebSocket establishes a persistent connection, allowing the server to proactively push data to the client.

| **Features** | **WebSocket**         | **REST API**        |
| ------------ | --------------------- | ------------------- |
| Delay        | Low                   | High than websocket |
| Push mode    | Server active push    | Client polling      |
| Connect      | Persistent connection | New per request     |

<br />

**Applicable scenarios** : real-time market display, order status monitoring, account asset change notification, high-frequency trading data acquisition

***

### **Connection address**

<br />**Public channels** (no certification required):

```Plain Production
wss://stream-hk.osl.com/ws/v5/public
```
```text Sandbox
wss://stream-hk.oslsandbox.com/ws/v5/public
```

<br />**Private channels** (authentication required):

```Plain Production
wss://stream-hk.osl.com/ws/v5/private
```
```text Sandbox
wss://stream-hk.oslsandbox.com/ws/v5/private
```

<br />**Connection parameters** :

| **Parameter**           | **Explanation**                               |
| ----------------------- | --------------------------------------------- |
| Heartbeat interval      | 30 seconds (recommended)                      |
| Connection timed out    | 60 seconds no data automatically disconnected |
| Connection restrictions | 100/IP, current active sessions               |
| Message size            | Up to 64KB                                    |

***

### Heartbeat

Client needs to send a heartbeat every 30 seconds to keep the connection active. If there is no subscription or server does not push data within 60 seconds after connection, the system will automatically disconnect.

**Heartbeat request** : `ping`

**Heartbeat response** : `pong`

***

### Error code

| **Error code** | **Explanation**           |
| -------------- | ------------------------- |
| 30001          | Channel does not exist    |
| 30002          | Illegal request           |
| 30003          | Invalid op                |
| 30004          | User needs to log in      |
| 30005          | Login failed              |
| 30011          | Invalid ACCESS\_KEY       |
| 30013          | Invalid ACCESS\_TIMESTAMP |
| 30014          | Request timestamp expired |
| 30015          | Invalid signature         |
| 30016          | Parameter error           |