gql_websocket_link
2.1.0, released a year ago by gql-dart.dev
GraphQL WebSocket link for executing queries, mutations, and subscriptions.
What it does
Provides a WebSocket link for GraphQL clients to execute operations and manage real-time subscriptions over web sockets. Supports auto-reconnection and multiple websocket sub-protocols like graphql-ws and graphql-transport-ws.
AI-written summary of version 2.1.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need GraphQL subscriptions in your Flutter or Dart app
- You are using the gql ecosystem and need a WebSocket transport layer
Skip it when
- You only need standard HTTP-based queries and mutations without real-time updates
- You are not using the gql client architecture
Strengths
- Supports both graphql-ws and graphql-transport-ws protocols
- Built-in autoReconnect and automatic resubscription handling
- Exposes connection state streams
Weaknesses
- The WebSocketLink class has some known issues documented in the project repository
- Requires using the broader gql link ecosystem
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 7
import "package:gql_link/gql_link.dart";
import "package:gql_websocket_link/gql_websocket_link.dart";
void main () {
final link = Link.from([
WebSocketLink("ws://<GRAPHQL_SERVER_ENDPOINT>/graphql"),
]);
}Alternatives
Packages that do the same job and could replace gql_websocket_link.
- sentry_link
Automatic capture of exceptions and GraphQL errors for the gql ecosystem like graphql and ferry.
86Compare - fresh_graphql
A GraphQL link for package:graphql that manages authentication tokens transparently.
77Compare - ferry_flutter
Flutter widgets for executing GraphQL operations using the ferry client
62Compare - angel3_websocket
WebSockets support and event broadcasting for the Angel3 framework.
77Compare
Works with
Packages commonly used together with gql_websocket_link: ones it builds on, ones built on it, and its own family.
- uuidgql_websocket_link depends on itGenerates and parses RFC‑4122/9562 UUIDs (v1‑v8) for Dart.
- web_socket_channelgql_websocket_link depends on itCross‑platform WebSocket channel wrapper for Dart
- rxdartgql_websocket_link depends on itImplementation of the ReactiveX API for asynchronous programming leveraging native Dart Streams.
- gqlgql_websocket_link depends on itParse, transform and print GraphQL documents in Dart.
- gql_linkgql_websocket_link depends on itModular AST-based GraphQL request execution interface.
- gql_http_linkSame familyHTTP link for executing GraphQL requests via JSON.
- normalizeSame familyNormalizes and denormalizes GraphQL responses to a cache-friendly map structure.
- gql_code_builderSame familyDart code builder generating typed classes from GraphQL documents and SDL