GraphQLWsMessage class

One message of the graphql-transport-ws protocol.

The protocol the graphql-ws library defines, which is what a current Apollo Client or urql speaks by default. Its vocabulary differs from the older subscriptions-transport-ws: an operation starts with subscribe rather than start, its events arrive as next rather than data, and a client ends it by sending complete rather than stop.

Constructors

GraphQLWsMessage(String type, {dynamic payload, String? id})
Builds a message of type.
GraphQLWsMessage.fromJson(Map map)
Reads a message off the wire.
factory

Properties

hashCode → int
The hash code for this object.
no setterinherited
id → String?
The operation this message belongs to, absent on connection-level ones.
final
payload → dynamic
The message body, whose shape depends on type.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
type → String
One of the protocol's message types, such as subscribe.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() → Map<String, dynamic>
The wire form of this message, with absent fields left out.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

complete → const String
Ends an operation. From the server it means the operation is over; from the client it means stop sending.
connectionAck → const String
Accepts the connection.
connectionInit → const String
Opens the connection, carrying whatever the client wants to authenticate with as its payload.
error → const String
Ends an operation that could not be executed, carrying the errors.
next → const String
One result of an operation.
ping → const String
Asks the other end to answer a pong. Either end may send it.
pong → const String
Answers a ping, echoing its payload.
subprotocol → const String
The protocol token a WebSocket handshake negotiates for this protocol.
subscribe → const String
Starts an operation, under an id the connection has not used yet.