Class GraphQLSubscription

java.lang.Object
com.codename1.io.graphql.GraphQLSubscription

public final class GraphQLSubscription extends Object

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

invalid reference
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.

  • 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.