Interface GraphQLWebSocketClientOptions<TTypings>

interface GraphQLWebSocketClientOptions<TTypings> {
    autoReconnect?: boolean;
    connectionAckTimeout?: number;
    connectionInitPayload?: Record<string, unknown>;
    createWebSocket?: CreateWebSocketFn;
    maxReconnectDelay?: number;
    minReconnectDelay?: number;
    protocol?: string;
    reconnectDelayMultiplier?: number;
    typings?: TTypings;
    url: string;
}

Type Parameters

Properties

autoReconnect?: boolean

Should the client automatically reconnect on normal socket closure? Defaults to true.

connectionAckTimeout?: number

Timeout to receive acknowledgement, in milliseconds. Defaults to 3000.

connectionInitPayload?: Record<string, unknown>

Payload to send during initialization. May be used server-side to acknowledge the connection.

createWebSocket?: CreateWebSocketFn

Overrides web socket creation. For example, when using GraphQLWebSocketClient on server-side, you'll need to create a WebSocket from "ws" instead of a standard WebSocket.

maxReconnectDelay?: number

Maximum delay to wait before reconnection, in milliseconds. Defaults to 30000.

minReconnectDelay?: number

Minimum delay to wait before reconnection, in milliseconds. Reconnections only happen with open subscriptions and are controlled per subscription (see GraphQLWebSocketClient.subscribe()). The minimum is 10. Defaults to 500.

protocol?: string

WebSocket sub-protocol to use. Either "graphql-transport-ws" or "graphql-ws" (legacy). Defaults to "graphql-transport-ws".

reconnectDelayMultiplier?: number

Reconnection delay multiplier. Defaults to 2 (for exponential back-off).

typings?: TTypings
url: string

URL to GraphQL API.