GraphQLWsServer class abstract

A server speaking the graphql-transport-ws protocol.

Subclass it and answer onConnect and onOperation, the same two decisions the older Server asks for. How events reach a subscriber is left to you, and so is the transport, which can be anything package:stream_channel can carry.

This package does not own the socket, so it cannot close one with a code. Override onClose on a WebSocket transport to pass the code on, which is what a client reads to tell a refused connection from a malformed message.

Constructors

GraphQLWsServer(GraphQLWsClient client, {Duration? connectionInitWaitTimeout})
Starts serving client.

Properties

client → GraphQLWsClient
The client this server is talking to.
final
connectionInitWaitTimeout → Duration?
How long to wait for connection_init before closing the connection.
final
done → Future
Completes when the connection has been closed on either side.
no setter
hashCode → int
The hash code for this object.
no setterinherited
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
onClose(int code, String reason) → FutureOr<void>
Closes the connection, naming the protocol's code and reason.
onConnect(GraphQLWsClient client, [Map? connectionParams]) → FutureOr<bool>
Whether to accept the connection, given the client's connection_init payload.
onOperation(String id, String query, [Map<String, dynamic>? variables, String? operationName]) → FutureOr<GraphQLResult>
Executes one operation and answers its result.
toString() → String
A string representation of this object.
inherited

Operators

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