import type { GraphQLDocument } from '@iota/iota-sdk/graphql'; interface ConnectionInitMessage { type: 'connection_init'; payload?: Record; } interface SubscribeMessage { id: string; type: 'subscribe'; payload: { query: string; variables?: Record; operationName?: string; extensions?: Record; }; } interface CompleteMessage { id: string; type: 'complete'; } interface PongMessage { type: 'pong'; payload?: Record; } /** The socket or handshake failed, as opposed to the server refusing one operation. */ export declare class GraphQLWebSocketConnectionError extends Error { } export type GraphQLSubscriptionVariables = Record; export type GraphQLSubscriptionRequest = { query: GraphQLDocument; /** Resolved on every send, so a resubscribe can carry a resume cursor. */ variables?: GraphQLSubscriptionVariables | (() => GraphQLSubscriptionVariables | undefined); onMessage: (data: T) => void; onError?: (errors: Array<{ message: string; }>) => void; onComplete?: () => void; signal?: AbortSignal; }; /** * Configuration options for the GraphQL WebSocket client. */ export type GraphQLWebSocketClientOptions = { /** * Custom WebSocket class to use. * Defaults to the global WebSocket class, if available. */ WebSocketConstructor?: typeof WebSocket; /** * Optional payload to send with the `connection_init` message. * Can be used for authentication tokens or other connection-level metadata. */ connectionParams?: Record | undefined; /** * Milliseconds to wait for the `connection_ack` message before timing out. * @default 30000 */ connectionAckTimeout?: number; /** * Milliseconds between reconnection attempts. * @default 3000 */ reconnectTimeout?: number; /** * Maximum number of reconnection attempts before giving up. * @default 5 */ maxReconnects?: number; /** * Milliseconds to wait for the server to refuse the operation. graphql-ws does not * acknowledge a `subscribe`, so an `error` frame is the only signal. Inside this window it * rejects `subscribe()`, after it it goes to `onError`. Messages arrive throughout. * @default 250 */ startupErrorGrace?: number; }; export declare class GraphQLWebSocketClient { #private; constructor(endpoint: string, options?: GraphQLWebSocketClientOptions); subscribe(request: GraphQLSubscriptionRequest): Promise<() => Promise>; send(message: ConnectionInitMessage | SubscribeMessage | CompleteMessage | PongMessage): Promise; close(): void; } export {}; //# sourceMappingURL=graphql-websocket-client.d.ts.map