Vessel WebSocket
WebSocket API provides real-time and efficient communication for traders and developers. Key details of the WebSocket functionality are as follows:
Base Endpoint
Testnet environment: testnet.trade.vessel.finance/ws
Mainnet environment: trade.vessel.finance/ws
Connection Validity
A single connection to the WebSocket API is valid for 24 hours.
Expect to be automatically disconnected after the 24-hour mark. Reconnection is required for continuous communication.
Ping and Pong Mechanism
The client must send a ping string to the server at least once every 10 minutes.
If the client doesn't receive a pong string in response to its ping, it should consider the connection broken and attempt to reconnect.
List Order and Timestamps
Lists returned via WebSocket are in chronological order by default, unless specified otherwise.
All timestamps provided in WebSocket messages are in milliseconds and follow the UTC time zone, unless explicitly noted otherwise.
Case Sensitivity
All field names and values in WebSocket messages are case-sensitive, unless specified otherwise. Developers should ensure accurate casing for seamless integration.
Subscription/Unsubscription
General Payload
The WebSocket messages for both subscription and unsubscription follow a common structure. The payload typically includes fields such as type, channel, id, and additional parameters based on the action being performed.
Example Channel-Specific Subscription Payload
{
"type": "subscribe",
"channel": "orderbook",
"id": "unique_subscription_id",
"symbol": "WBTCUSDT"
}
Example Channel-Specific Unsubbscription Payload
{
"type": "unsubscribe",
"channel": "orderbook",
"id": "unique_subscription_id",
"symbol": "WBTCUSDT"
}
Limitation
WebSocket connections have initial limits to manage data efficiently. Please note the following limits for specific WebSocket channels:
Kline Channel: The initial limit is set to 50 data points.
Recent Trades Channel: The initial limit is set to 20 data points.
Order Book Channel: The initial limit is set to 1000 data points for both bid and ask sides.
These limits are in place to ensure smooth data transmission and optimal performance. If you have any specific requirements or need further assistance, feel free to reach out.