gql_sse_link 1.0.0-beta.3
gql_sse_link: ^1.0.0-beta.3 copied to clipboard
GQL terminating Link to execute GraphQL subscriptions over Server-Sent Events (graphql-sse "distinct connections" protocol).
1.0.0-beta.3 #
connectionParamscallback — an optionalFutureOr<Map<String, String>?> Function()?resolved fresh on every (re)connection, letting you inject headers (typically a refreshed auth token) that overridedefaultHeadersand the request's context headers. The SSE analog ofgql_websocket_link'sconnectionParams. A failure resolving it is treated as a transient drop.
1.0.0-beta.2 #
- Transparent reconnection. A subscription whose stream drops mid-flight —
the transport errors (e.g.
ClientException: Error in input stream) or the stream ends with noevent: complete— is now reconnected in the background by re-issuing thePOST, so consumers see one continuous stream instead of a permanent failure. An explicitevent: completeis still terminal, and deterministic failures (HTTP 4xx, malformed payloads, request-format/context errors) still propagate as errors. - Clean teardown. Cancelling a subscription now aborts the in-flight HTTP response and swallows the resulting transport error, so nothing escapes to the zone.
- Configurable retry policy via new optional, backward-compatible
constructor parameters modelled on
gql_websocket_link:retryAttempts(defaults toSseLink.unlimitedRetries),retryWait(defaults toSseLink.randomizedExponentialBackoff— exponential with a 30s cap and jitter),shouldRetry(defaults toSseLink.shouldRetryDefault), andretryHealthyThreshold(resets the backoff after a connection stays healthy). Last-Event-IDresumption remains a documented non-goal: distinct-connections mode re-executes from scratch and subscriptions stream full current state, so a plain re-POSTis sufficient.