Skip to main content

WebSocket Transaction Streaming

The Unified Transaction APIs support real-time transaction streaming via WebSocket connections, using the same authentication pattern as HTTP APIs.

Connection URL

Authentication Flow

WebSocket connections use the same authentication pattern as HTTP APIs:
  1. Connect to WebSocket endpoint
  2. Authenticate with API key
  3. Use authenticated session for all subsequent commands

Authentication

Step 1: Connect and Authenticate

Authentication Request

Authentication Response

Available Actions

After authentication, you can use these WebSocket actions:

1. Subscribe to Transactions

Subscribe to real-time transaction updates for a specific exchange.

Request

2. Subscribe to Transactions (after authentication) - Your Own Credentials

Example: OKX WebSocket with Passphrase

Parameters

Response

2. Validate Credentials

Validate exchange credentials without fetching transactions.

Request (Internal Credentials)

Request (Your Own Credentials)

Request (OKX with Passphrase)

Response (Success)

Response (Error)

3. Get Exchanges

Retrieve list of supported exchanges and their capabilities.

Request

Response

Complete WebSocket Example

Error Handling

Common WebSocket Errors

Error Response Format

Implement proper error handling and reconnection logic in your WebSocket clients for production use.