Authorize
{{WSS_SERVER}}/ws/user
Modified at: 18 天前
Before subscribing to user data channels, you need to authenticate by connecting to the authorization channel. Use your API key for authentication.
Message Structure
Send Message
- Type: Specifies the type of WebSocket message.
- Type: String.
- Value: "subscribe"
- Channel: Indicates the type of data to subscribe to (e.g., order book updates).
- Type: String.
- Value: "authorize"
- ID: A unique identifier for the subscription request. Write randomly or use any unique identifier.
- Type: String.
- Example. "authorize"
- vesselApiKey: Associated with the user's account and you can get it from our website.
- Type: String.
- Example: "WBTCUSDT"
- vesselTimestamp: A timestamp indicating the time at which the request is made. It adds a time-based component to the authorization for increased security.
- Type: UNIX timestamp in milliseconds
- Example: 1703484873954
- vesselSignature: Generate by HMAC. The signature message vesselTimestamp + "websocket" + id. You can find comprehensive details on generating the signature in Sign Request by HMAC Guide.
- Type: String.
- Example: "IGYszasEmHbFIWX3XA1xZvnxtr4CPA0742GmnTBkRj8"
Send Message Example:
{
"type": "subscribe",
"channel": "authorize",
"id": "authorize",
"vesselApiKey": "0x97cb025549d36946fe5a401454a437c0",
"vesselPassphrase": "0xab750ece4cc84e4e47c9fe6f651905a7",
"vesselTimestamp": 1703484873954,
"vesselSignature": "IGYszasEmHbFIWX3XA1xZvnxtr4CPA0742GmnTBkRj8="
}
Receive Message
- Error: Indicates whether an error occurred during the authorization process.
- Type: Bool
- Value: "false"
- Id: Identifies the authorization request.
- Type: String
- Value: "authorize"
- Msg: Indicates the outcome of the authorization attempt.
- Type: String
- Example: "success"
Receive Message Example:
{ error: false, id: "authorize", msg: "success" }
请求参数
无
Modified at 18 天前