Module: common
Enumerations
Interfaces
- CompleteMessage
- ConnectionAckMessage
- ConnectionInitMessage
- Disposable
- ErrorMessage
- ExecutionPatchResult
- ExecutionResult
- NextMessage
- PingMessage
- PongMessage
- Sink
- SubscribeMessage
- SubscribePayload
Common
ID
Ƭ ID: string
ID is a string type alias representing the globally unique ID used for identifying subscriptions established by the client.
Defined in
JSONMessageReplacer
Ƭ JSONMessageReplacer: (this
: any
, key
: string
, value
: any
) => any
Function that allows customization of the produced JSON string
for the elements of an outgoing Message
object.
Read more about using it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#the_replacer_parameter
Type declaration
▸ (this
, key
, value
): any
Parameters
Name | Type |
---|---|
this | any |
key | string |
value | any |
Returns
any
Defined in
JSONMessageReviver
Ƭ JSONMessageReviver: (this
: any
, key
: string
, value
: any
) => any
Function for transforming values within a message during JSON parsing The values are produced by parsing the incoming raw JSON.
Read more about using it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse#using_the_reviver_parameter
Type declaration
▸ (this
, key
, value
): any
Parameters
Name | Type |
---|---|
this | any |
key | string |
value | any |
Returns
any
Defined in
Message
Ƭ Message<T
>: T
extends ConnectionAck
? ConnectionAckMessage
: T
extends ConnectionInit
? ConnectionInitMessage
: T
extends Ping
? PingMessage
: T
extends Pong
? PongMessage
: T
extends Subscribe
? SubscribeMessage
: T
extends Next
? NextMessage
: T
extends Error
? ErrorMessage
: T
extends Complete
? CompleteMessage
: never
Type parameters
Name | Type |
---|---|
T | extends MessageType = MessageType |
Defined in
GRAPHQL_TRANSPORT_WS_PROTOCOL
• Const
GRAPHQL_TRANSPORT_WS_PROTOCOL: "graphql-transport-ws"
The WebSocket sub-protocol used for the GraphQL over WebSocket Protocol.
Defined in
isMessage
▸ isMessage(val
): val is ConnectionInitMessage | ConnectionAckMessage | PingMessage | PongMessage | SubscribeMessage | NextMessage | ErrorMessage | CompleteMessage
Checks if the provided value is a valid GraphQL over WebSocket message.
Parameters
Name | Type |
---|---|
val | unknown |
Returns
val is ConnectionInitMessage | ConnectionAckMessage | PingMessage | PongMessage | SubscribeMessage | NextMessage | ErrorMessage | CompleteMessage
Deprecated
Use validateMessage
instead.
Defined in
parseMessage
▸ parseMessage(data
, reviver?
): Message
Parses the raw websocket message data to a valid message.
Parameters
Name | Type |
---|---|
data | unknown |
reviver? | JSONMessageReviver |
Returns
Defined in
stringifyMessage
▸ stringifyMessage<T
>(msg
, replacer?
): string
Stringifies a valid message ready to be sent through the socket.
Type parameters
Name | Type |
---|---|
T | extends MessageType |
Parameters
Name | Type |
---|---|
msg | Message <T > |
replacer? | JSONMessageReplacer |
Returns
string
Defined in
validateMessage
▸ validateMessage(val
): Message
Validates the message against the GraphQL over WebSocket Protocol.
Invalid messages will throw descriptive errors.
Parameters
Name | Type |
---|---|
val | unknown |