Interface WebSocketClientOptionsWithAPIKey

Providing the required WebSocketClientAuthOptions object will allow the client to make authenticated subscriptions as well as public subscriptions

Example

  import { WebSocketClient } from '@idexio/idex-sdk'

const client = new WebSocketClient({
// Edit the values before for your environment
auth: {
apiKey: '1f7c4f52-4af7-4e1b-aa94-94fac8d931aa',
apiSecret: 'axuh3ywgg854aq7m73oy6gnnpj5ar9a67szuw5lclbz77zqu0j',
wallet: '0x...',
}
// sandbox: true,
// logger: console.log
});


See

docs WebSocket API Documentation

interface WebSocketClientOptionsWithAPIKey {
    auth: WebSocketClientAuthOptions;
    sandbox?: boolean;
    logger?: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    };
    clientId?: string;
    shouldReconnectAutomatically?: boolean;
}

Hierarchy

  • WebSocketClientOptionsBase
    • WebSocketClientOptionsWithAPIKey

Properties

Inherit Doc

sandbox?: boolean

If true, client will point to the sandbox API endpoint.

See

Sandbox API Documentation

Default Value

false
logger?: {
    (...data: any[]): void;
    (message?: any, ...optionalParams: any[]): void;
}

Provide a logging function if you would like the client to log internal messages. The function should match console.log signature.

Type declaration

    • (...data: any[]): void
    • Parameters

      • Rest ...data: any[]

      Returns void

    • (message?: any, ...optionalParams: any[]): void
    • Parameters

      • Optional message: any
      • Rest ...optionalParams: any[]

      Returns void

Example

new WebSocketClient({
logger: console.log
})
clientId?: string

May be used to uniquely identify this client if the logger function is utilized.

  • If not provided, clients will receive id's which increment each time they are created.
shouldReconnectAutomatically?: boolean

If true (default), automatically reconnects when connection is closed by the server or network errors

See

WebSocket Connection Maintenance

Default Value

true