Catch the highlights of GraphQLConf 2023! Click for recordings. Or check out our recap blog post.
Documentation
Interfaces
client.Client

Interface: Client<SingleConnection>

client.Client

Type parameters

NameType
SingleConnectionextends boolean = false

Properties

dispose

dispose: () => void

Dispose of the client, destroy connections and clean up resources.

Type declaration

▸ (): void

Dispose of the client, destroy connections and clean up resources.

Returns

void

Defined in

src/client.ts:255

Methods

iterate

iterate<Data, Extensions>(request, on?): AsyncIterableIterator<ExecutionResult<Data, Extensions>>

Subscribes and iterates over emitted results from an SSE connection through the returned async iterator.

Type parameters

NameType
DataRecord<string, unknown>
Extensionsunknown

Parameters

NameTypeDescription
requestRequestParams-
on?SingleConnection extends true ? never : EventListeners<false>The event listener for "distinct connections mode". Note that no events will be emitted in "single connection mode"; for that, consider using the event listener in ClientOptions.

Returns

AsyncIterableIterator<ExecutionResult<Data, Extensions>>

Defined in

src/client.ts:248


subscribe

subscribe<Data, Extensions>(request, sink, on?): () => void

Subscribes to receive through a SSE connection.

It uses the sink to emit received data or errors. Returns a dispose function used for dropping the subscription and cleaning up.

Type parameters

NameType
DataRecord<string, unknown>
Extensionsunknown

Parameters

NameTypeDescription
requestRequestParams-
sinkSink<ExecutionResult<Data, Extensions>>-
on?SingleConnection extends true ? never : EventListeners<false>The event listener for "distinct connections mode". Note that no events will be emitted in "single connection mode"; for that, consider using the event listener in ClientOptions.

Returns

fn

▸ (): void

Returns

void

Defined in

src/client.ts:237