public final class GraphQLSubscription

  1. Object
  2. GraphQLSubscription

Handle for a live GraphQL subscription. Implements the graphql-transport-ws message protocol over WebSocket (introduced in core alongside this package): connection_init -> connection_ack -> subscribe, then a stream of next payloads terminated by complete or error.

Each next payload’s data object is mapped to T and delivered to Handler.onNext(Object). All handler callbacks are dispatched on the Codename One EDT (matching the OnComplete semantics the query and mutation paths use), even though the underlying WebSocket fires on a background thread.

The connection offers the graphql-transport-ws subprotocol during the WebSocket handshake (RFC 6455 Sec-WebSocket-Protocol), as the graphql-ws specification requires.

Nested types

interface GraphQLSubscription.HandlerReceives the events of one subscription.

Methods

public void cancel()Cancels the subscription: sends a complete to the server and closes the socket.

Inherited methods

Method details

cancel

public void cancel()
Cancels the subscription: sends a complete to the server and closes the socket. Idempotent; safe to call from any thread.