gql_websocket_link library

GQL WebSocket link

Classes

ConnectionAck
The server will send this acknowledgment message after receiving the init command from the client if the init was successful.
ConnectionError
The server will send this error message after receiving the init command from the client if the init was not successful.
ConnectionKeepAlive
The server will send this message to keep the connection alive
GraphQLSocketMessage
Base type for representing a server-client subscription message.
InitOperation
After establishing a connection with the server, the client will send this message to tell the server that it is ready to begin sending new subscription queries.
JsonSerializable
LikeCloseEvent
Minimal close event interface required by the lib for error and socket close handling. */
MessageTypes
These messages represent the structures used for Client-server communication in a GraphQL web-socket subscription. Each message is represented in a JSON format where the data type is denoted by the type field. A list of constants used for identifying message types
RequestId
StartOperation
A message to tell the server to create a subscription. The contents of the query will be defined by the payload request. The id provided will be used to tag messages such that they can be identified for this subscription instance. id values should be unique and not be re-used during the lifetime of the server.
StopOperation
Tell the server to stop sending subscription data for a particular subscription instance. See StartOperation.
SubscriptionComplete
Server message to the client to indicate that no more data will be sent for a particular subscription instance.
SubscriptionData
Data sent from the server to the client with subscription data or error payload. The user should check the errors result before processing the data value. These error are from the query resolvers.
SubscriptionError
Errors sent from the server to the client if the subscription operation was not successful, usually due to GraphQL validation errors.
TransportWsClient
@category Client */
TransportWsClientOptions
Configuration used for the GraphQL over WebSocket client.
TransportWsEvent
An event dispatched by the TransportWsClient.
TransportWsEventHandler<T>
A class that handles events dispatched by the TransportWsClient.
UnknownData
Not expected to be created. Indicates there are problems parsing the server response, or that new unsupported types have been added to the subscription implementation.
A Universal WebSocket Link implementation to support the WebSocket-GraphQL transport. It supports subscriptions, query and mutation operations as well.
WebSocketMaker
Creates a WebSocketChannel from a URL or a ChannelGenerator.

Enums

ConnectionState
Possible connection states of the WebSocketLink.
TransportWsEventType

Properties

uuid → Uuid
final

Functions

createClient(TransportWsClientOptions options) TransportWsClient
Creates a disposable GraphQL over WebSocket client.

Typedefs

ChannelGenerator = FutureOr<WebSocketChannel> Function()
GraphQLSocketMessageDecoder = FutureOr<Map<String, dynamic>>? Function(dynamic message)
GraphQLSocketMessageEncoder = FutureOr<String> Function(Map<String, dynamic> message)

Exceptions / Errors

WebSocketLinkParserException
Exception occurring when response parsing fails
WebSocketLinkServerException
Exception occurring when network fails or parsed response is missing both data and errors