Skip to content

Latest commit

 

History

History
95 lines (57 loc) · 2.93 KB

message.md

File metadata and controls

95 lines (57 loc) · 2.93 KB

graphql-ws / message

Module: message

Table of contents

Enumerations

Interfaces

Type aliases

Functions

Type aliases

Message

Ƭ 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

Type parameters:

Name Type Default
T MessageType MessageType

Functions

isMessage

isMessage(val: unknown): val is ConnectionInitMessage | ConnectionAckMessage | SubscribeMessage | NextMessage | ErrorMessage | CompleteMessage

Checks if the provided value is a message.

Parameters:

Name Type
val unknown

Returns: val is ConnectionInitMessage | ConnectionAckMessage | SubscribeMessage | NextMessage | ErrorMessage | CompleteMessage


parseMessage

parseMessage(data: unknown): Message

Parses the raw websocket message data to a valid message.

Parameters:

Name Type
data unknown

Returns: Message


stringifyMessage

stringifyMessage<T>(msg: Message<T>): string

Stringifies a valid message ready to be sent through the socket.

Type parameters:

Name Type
T MessageType

Parameters:

Name Type
msg Message<T>

Returns: string