graphql-ws / message
- CompleteMessage
- ConnectionAckMessage
- ConnectionInitMessage
- ErrorMessage
- NextMessage
- SubscribeMessage
- SubscribePayload
Ƭ Message<T>: T extends ConnectionAck ? ConnectionAckMessage : T extends ConnectionInit ? ConnectionInitMessage : T extends Subscribe ? SubscribeMessage : T extends Next ? NextMessage : T extends Error ? ErrorMessage : T extends Complete ? CompleteMessage : never
Name | Type | Default |
---|---|---|
T |
MessageType | MessageType |
▸ isMessage(val
: unknown): val is ConnectionInitMessage | ConnectionAckMessage | SubscribeMessage | NextMessage | ErrorMessage | CompleteMessage
Checks if the provided value is a message.
Name | Type |
---|---|
val |
unknown |
Returns: val is ConnectionInitMessage | ConnectionAckMessage | SubscribeMessage | NextMessage | ErrorMessage | CompleteMessage
▸ parseMessage(data
: unknown): Message
Parses the raw websocket message data to a valid message.
Name | Type |
---|---|
data |
unknown |
Returns: Message
▸ stringifyMessage<T>(msg
: Message<T>): string
Stringifies a valid message ready to be sent through the socket.
Name | Type |
---|---|
T |
MessageType |
Name | Type |
---|---|
msg |
Message<T> |
Returns: string