Interface: Client<SingleConnection>
client.Client
Type parameters
| Name | Type |
|---|---|
SingleConnection | extends 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
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
| Name | Type |
|---|---|
Data | Record<string, unknown> |
Extensions | unknown |
Parameters
| Name | Type | Description |
|---|---|---|
request | RequestParams | - |
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
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
| Name | Type |
|---|---|
Data | Record<string, unknown> |
Extensions | unknown |
Parameters
| Name | Type | Description |
|---|---|---|
request | RequestParams | - |
sink | Sink<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