TransportWSServer class abstract
The server side of one connection of the graphql-transport-ws protocol,
which the graphql-ws client and Apollo Client 3 speak.
It reads and writes JSON text over channel, such as a WebSocket's, and
closes the connection with close, given a close code of
TransportWSCloseCode and a reason, as the protocol reports errors that
way. Extend it, and implement onSubscribe to run operations, usually with
GraphQL.parseAndExecute.
See: https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
Constructors
Properties
-
channel
→ StreamChannel<
String> -
The JSON text messages of the connection.
final
- close → void Function(int code, String reason)
-
Closes the connection with a close code and a reason.
final
-
connectionAckPayload
→ Map<
String, dynamic> ? -
The payload of the
connection_ack, if any.no setter - connectionInitWaitTimeout → Duration
-
How long to wait for
connection_init, before closing with TransportWSCloseCode.connectionInitialisationTimeout.final -
done
→ Future<
void> -
Completes when the connection has ended.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAcknowledged → bool
-
Whether the connection was acknowledged, so operations can run.
no setter
- keepAliveInterval → Duration?
-
How often to send a
pingonce connected, if at all.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onConnect(
Map< String, dynamic> ? payload) → FutureOr<bool> -
Decides whether to accept a connection, given the
payloadof itsconnection_init, such as credentials. Accepts all by default; returnfalseto close it with TransportWSCloseCode.forbidden. -
onSubscribe(
String id, String query, {Map< String, dynamic> ? variables, String? operationName, Map<String, dynamic> ? extensions}) → FutureOr<Object?> -
Runs the operation
idof thesubscribepayload: itsquery,variables,operationNameandextensions. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited