Module: client
Classes
Interfaces
Client
Event
Ƭ Event: EventConnecting
| EventOpened
| EventConnected
| EventPing
| EventPong
| EventMessage
| EventClosed
| EventError
All events that could occur.
Defined in
EventClosed
Ƭ EventClosed: "closed"
WebSocket connection has closed.
Defined in
EventClosedListener
Ƭ EventClosedListener: (event
: unknown
) => void
The argument is actually the websocket CloseEvent
, but to avoid
bundling DOM typings because the client can run in Node env too,
you should assert the websocket type during implementation.
Type declaration
▸ (event
): void
Parameters
Name | Type |
---|---|
event | unknown |
Returns
void
Defined in
EventConnected
Ƭ EventConnected: "connected"
Open WebSocket connection has been acknowledged.
Defined in
EventConnectedListener
Ƭ EventConnectedListener: (socket
: unknown
, payload
: ConnectionAckMessage
["payload"
], wasRetry
: boolean
) => void
The first argument is actually the WebSocket
, but to avoid
bundling DOM typings because the client can run in Node env too,
you should assert the websocket type during implementation.
Also, the second argument is the optional payload that the server may
send through the ConnectionAck
message.
Type declaration
▸ (socket
, payload
, wasRetry
): void
Parameters
Name | Type |
---|---|
socket | unknown |
payload | ConnectionAckMessage ["payload" ] |
wasRetry | boolean |
Returns
void
Defined in
EventConnecting
Ƭ EventConnecting: "connecting"
WebSocket started connecting.
Defined in
EventConnectingListener
Ƭ EventConnectingListener: (isRetry
: boolean
) => void
Type declaration
▸ (isRetry
): void
Parameters
Name | Type |
---|---|
isRetry | boolean |
Returns
void
Defined in
EventError
Ƭ EventError: "error"
WebSocket connection had an error or client had an internal error.
Defined in
EventErrorListener
Ƭ EventErrorListener: (error
: unknown
) => void
Events dispatched from the WebSocket onerror
are handled in this listener,
as well as all internal client errors that could throw.
Type declaration
▸ (error
): void
Parameters
Name | Type |
---|---|
error | unknown |
Returns
void
Defined in
EventListener
Ƭ EventListener<E
>: E
extends EventConnecting
? EventConnectingListener
: E
extends EventOpened
? EventOpenedListener
: E
extends EventConnected
? EventConnectedListener
: E
extends EventPing
? EventPingListener
: E
extends EventPong
? EventPongListener
: E
extends EventMessage
? EventMessageListener
: E
extends EventClosed
? EventClosedListener
: E
extends EventError
? EventErrorListener
: never
Type parameters
Name | Type |
---|---|
E | extends Event |
Defined in
EventMessage
Ƭ EventMessage: "message"
A message has been received.
Defined in
EventMessageListener
Ƭ EventMessageListener: (message
: Message
) => void
Called for all valid messages received by the client. Mainly useful for debugging and logging received messages.
Type declaration
▸ (message
): void
Parameters
Name | Type |
---|---|
message | Message |
Returns
void
Defined in
EventOpened
Ƭ EventOpened: "opened"
WebSocket has opened.
Defined in
EventOpenedListener
Ƭ EventOpenedListener: (socket
: unknown
) => void
The first argument is actually the WebSocket
, but to avoid
bundling DOM typings because the client can run in Node env too,
you should assert the websocket type during implementation.
Type declaration
▸ (socket
): void
Parameters
Name | Type |
---|---|
socket | unknown |
Returns
void
Defined in
EventPing
Ƭ EventPing: "ping"
PingMessage
has been received or sent.
Defined in
EventPingListener
Ƭ EventPingListener: (received
: boolean
, payload
: PingMessage
["payload"
]) => void
The first argument communicates whether the ping was received from the server.
If false
, the ping was sent by the client.
Type declaration
▸ (received
, payload
): void
Parameters
Name | Type |
---|---|
received | boolean |
payload | PingMessage ["payload" ] |
Returns
void
Defined in
EventPong
Ƭ EventPong: "pong"
PongMessage
has been received or sent.
Defined in
EventPongListener
Ƭ EventPongListener: (received
: boolean
, payload
: PongMessage
["payload"
]) => void
The first argument communicates whether the pong was received from the server.
If false
, the pong was sent by the client.
Type declaration
▸ (received
, payload
): void
Parameters
Name | Type |
---|---|
received | boolean |
payload | PongMessage ["payload" ] |
Returns
void
Defined in
createClient
▸ createClient<P
>(options
): Client
Creates a disposable GraphQL over WebSocket client.
Type parameters
Name | Type |
---|---|
P | extends undefined | Record <string , unknown > = undefined | Record <string , unknown > |
Parameters
Name | Type |
---|---|
options | ClientOptions <P > |
Returns
Defined in
Other
CloseCode
Re-exports CloseCode
CompleteMessage
Re-exports CompleteMessage
ConnectionAckMessage
Re-exports ConnectionAckMessage
ConnectionInitMessage
Re-exports ConnectionInitMessage
Disposable
Re-exports Disposable
ErrorMessage
Re-exports ErrorMessage
ExecutionPatchResult
Re-exports ExecutionPatchResult
ExecutionResult
Re-exports ExecutionResult
GRAPHQL_TRANSPORT_WS_PROTOCOL
Re-exports GRAPHQL_TRANSPORT_WS_PROTOCOL
ID
Re-exports ID
JSONMessageReplacer
Re-exports JSONMessageReplacer
JSONMessageReviver
Re-exports JSONMessageReviver
Message
Re-exports Message
MessageType
Re-exports MessageType
NextMessage
Re-exports NextMessage
PingMessage
Re-exports PingMessage
PongMessage
Re-exports PongMessage
Sink
Re-exports Sink
SubscribeMessage
Re-exports SubscribeMessage
SubscribePayload
Re-exports SubscribePayload
isMessage
Re-exports isMessage
parseMessage
Re-exports parseMessage
stringifyMessage
Re-exports stringifyMessage
validateMessage
Re-exports validateMessage