Skip to main content
Subscribe to real-time user fill updates. Account-specific channel. WebSocket URL: wss://api.hotstuff.trade/ws Channel: fills

Example Request

{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "subscribe",
  "params": {
    "channel": "fills",
    "user": "0xxxx"
  }
}

Parameters

ParameterTypeRequiredDescriptionExample
jsonrpcstringYesJSON-RPC version"2.0"
idstring/numberYesRequest identifier for tracking"1" or 1
methodstringYesAction to perform"subscribe" or "unsubscribe"
channelstringYesChannel name"fills"
userstringYesUser wallet address"0xxxx"

Supported Methods

  • subscribe - Subscribe to user fill updates
  • unsubscribe - Unsubscribe from user fill updates

Authentication

This endpoint requires a valid user wallet address to receive account-specific fill updates.

WebSocket Client Examples

Python

import websocket
import json

def on_message(ws, message):
    print(f"Received: {message}")

def on_open(ws):
    subscribe_msg = {
        "jsonrpc": "2.0",
        "id": "1",
        "method": "subscribe",
        "params": {
            "channel": "fills",
            "user": "0xxxx"
        }
    }
    ws.send(json.dumps(subscribe_msg))

ws = websocket.WebSocketApp("wss://api.hotstuff.trade/ws",
                          on_message=on_message,
                          on_open=on_open)
ws.run_forever()

JavaScript

const ws = new WebSocket('wss://api.hotstuff.trade/ws');

ws.onopen = function() {
    const subscribeMsg = {
        "jsonrpc": "2.0",
        "id": "1",
        "method": "subscribe",
        "params": {
            "channel": "fills",
            "user": "0xxxx"
        }
    };
    ws.send(JSON.stringify(subscribeMsg));
};

ws.onmessage = function(event) {
    console.log('Received:', event.data);
};
Note: The “Try It” button above uses HTTP requests, which won’t work for WebSocket connections. Use the WebSocket client examples instead.