Skip to content

User Channel (WebSocket)

This channel pushes order lifecycle events and trade confirmations for the authenticated user. You must present valid CLOB API credentials in the first message after connecting.

Server: wss://ws.openfish.fun/ws/user


Direction: Client -> Server

Send the authentication payload as your first message within 10 seconds of establishing the connection:

FieldTypeRequiredDescription
authobjectYesCLOB API credentials
auth.apiKeystringYesAPI key (UUID)
auth.secretstringYesAPI secret
auth.passphrasestringYesAPI passphrase
marketsarrayNoCondition IDs to filter. Omit for all markets.
{
"auth": {
"apiKey": "9180014b-33c8-9240-a14b-bdca11c0a465",
"secret": "your-api-secret",
"passphrase": "your-passphrase"
}
}

Success response:

{"type": "auth", "status": "ok"}

Error responses:

{"error": "invalid auth message"}
{"error": "auth timeout"}
{"error": "invalid token"}

For backward compatibility, pass the API key as a query parameter:

wss://ws.openfish.fun/ws/user?token={api_key}

The server emits a text "PING" frame every 10 seconds. The client must reply with text "PONG".


Triggered whenever an order is placed, partially filled, or cancelled.

FieldTypeDescription
typestring"order"
order_idstringOrder ID (UUID)
event_typestring"PLACEMENT", "UPDATE", or "CANCELLATION"
statusstring"LIVE", "MATCHED", "CANCELED"
marketstringCondition ID
asset_idstringToken ID
sidestring"BUY" or "SELL"
pricestringOrder price
original_sizestringOriginal size
size_matchedstringAmount matched so far
outcomestring"YES" or "NO"
order_typestring"GTC", "FOK", "GTD"
ownerstringAPI key of the order owner
timestampintegerUnix timestamp

Triggered when a trade is matched or when a previously matched trade changes status.

FieldTypeDescription
typestring"trade"
trade_idstringTrade UUID
taker_order_idstringTaker’s order ID
marketstringCondition ID
asset_idstringToken ID
sidestring"BUY" or "SELL"
pricestringTrade price
sizestringTrade size
feestringFee amount
statusstring"MATCHED", "CONFIRMED", "FAILED"
trader_sidestring"TAKER" or "MAKER" — your role in the trade
maker_ordersarrayMatched maker order details (order_id, owner, maker_address, matched_amount)
timestampintegerUnix timestamp