Interface WebSocketClientOptionsPublicOnly

WebSocket constructor options which will only allow you to subscribe to public subscriptions.

  • All properties are optional, thus new WebSocketClient() is valid for public subscriptions.

Example

  import { WebSocketClient } from '@kumabid/kuma-sdk';

// all options are optional for public only clients
const webSocketClientPublicOnly = new WebSocketClient({
// sandbox: true,
});
interface WebSocketClientOptionsPublicOnly {
    sandbox?: boolean;
    logger?: {
        (...data: any[]): void;
        (message?: any, ...optionalParams: any[]): void;
    };
    clientId?: string;
    shouldReconnectAutomatically?: boolean;
}

Hierarchy

  • WebSocketClientOptionsBase
    • WebSocketClientOptionsPublicOnly

Properties

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