Overview

This page describes subscribing to data streams using the WebSocket API.

WebSocket endpoint is available for real-time data streaming of particular data. The WebSocket URL is

wss://data.blockliquidity.xyz/ws

Data Feed Subscription

To connect to the WebSocket API, you must establish a WebSocket connection to the URL. Once connected, you can initiate a data feed by sending a subscription message with the following format

{
    "method": "subscribe",
    "subscription": {...}
}

The subscription object contains the details of the specific feed you want to subscribe to. Choose from the following subscription types and provide the corresponding properties:

Liquidations

{
    "event_type": "liquidations",
    "coin": "<coin>",  // optional 
    "user": "<address>"  // optional
}

Other subscription types

Coming soon ...

# "fills",
# "internal_transfers",
# "c_withdrawals",
# "c_deposits",
# "spot_transfers",
# "account_class_transfers",
# "delegations",
# "validator_rewards",
# "order_statuses",
# "vault_deposits",
# "vault_withdrawals",
# "sub_account_transfers",
# "rewards_claims",
# "withdraws",
# "deposits",
# "vault_creates",
# "vault_distributions",
# "spot_genesis",
# "account_activation_gas",
# "perp_dex_class_transfer",
# "deploy_gas_auction",
# "funding"

Examples

The following is an example of subscription message for liquidations

Unsubscribing from WebSocket feeds

To unsubscribe from a specific data feed on the Hyperliquid WebSocket API, you need to send an unsubscribe message with the following format:

The subscription object should match the original subscription message that was sent when subscribing to the feed. This allows the server to identify the specific feed you want to unsubscribe from. By sending this unsubscribe message, you inform the server to stop sending further updates for the specified feed.

Please note that unsubscribing from a specific feed does not affect other subscriptions you may have active at that time. To unsubscribe from multiple feeds, you can send multiple unsubscribe messages, each with the appropriate subscription details.

Timeouts and heartbeats

The server will close any connection if it hasn't sent a message to it in the last 300 seconds. If you are subscribing to a channel that doesn't receive messages every 300 seconds, you can send heartbeat messages to keep your connection alive. The format for these messages are:

The server will respond with:

Last updated