Class GraphQLTransportWSSubprotocolHandler

  • All Implemented Interfaces:
    WebSocketSubprotocolHandler

    public class GraphQLTransportWSSubprotocolHandler
    extends Object
    implements WebSocketSubprotocolHandler
    Implementation of the `graphql-transport-ws` protocol. The protocol specification is at https://github.com/enisdenjo/graphql-ws/blob/master/PROTOCOL.md
    • Constructor Detail

      • GraphQLTransportWSSubprotocolHandler

        public GraphQLTransportWSSubprotocolHandler​(io.vertx.core.http.WebSocket webSocket,
                                                    Integer subscriptionInitializationTimeout,
                                                    Map<String,​Object> initPayload,
                                                    Runnable onClose)
    • Method Detail

      • ensureInitialized

        public io.smallrye.mutiny.Uni<Void> ensureInitialized()
        Description copied from interface: WebSocketSubprotocolHandler
        This is called to initialize the websocket connection and prepare it for executing operations. The returned Uni is completed when the websocket is fully initialized (including necessary server ACKs specific to the protocol). If the handler is already fully initialized, this returns a completed Uni.
        Specified by:
        ensureInitialized in interface WebSocketSubprotocolHandler
      • executeUni

        public String executeUni​(javax.json.JsonObject request,
                                 io.smallrye.mutiny.subscription.UniEmitter<? super String> emitter)
        Description copied from interface: WebSocketSubprotocolHandler
        Requests an execution of a single-result operation over the websocket.
        Specified by:
        executeUni in interface WebSocketSubprotocolHandler
        Parameters:
        request - Request in full JSON format describing the operation to be executed.
        emitter - Emitter that should receive the completion event (or an error) when the operation finishes.
        Returns:
        The generated internal ID of this operation.
      • executeMulti

        public String executeMulti​(javax.json.JsonObject request,
                                   io.smallrye.mutiny.subscription.MultiEmitter<? super String> emitter)
        Description copied from interface: WebSocketSubprotocolHandler
        Requests an execution of a subscription operation over the websocket.
        Specified by:
        executeMulti in interface WebSocketSubprotocolHandler
        Parameters:
        request - Request in full JSON format describing the operation to be executed.
        emitter - Emitter that should receive the completion events (or an error) from the subscription.
        Returns:
        The generated internal ID of this operation.
      • cancelUni

        public void cancelUni​(String id)
        Description copied from interface: WebSocketSubprotocolHandler
        Cancels an active single-result operation with the given ID. This does not do anything with the Emitter for this operation, it only sends a cancellation message to the server (if applicable depending on the protocol), and marks this operation as finished.
        Specified by:
        cancelUni in interface WebSocketSubprotocolHandler
        Parameters:
        id - ID of the operation (returned from calling `executeUni`)
      • cancelMulti

        public void cancelMulti​(String id)
        Description copied from interface: WebSocketSubprotocolHandler
        Cancels an active subscription with the given ID. This does not do anything with the Emitter for this operation, it only sends a cancellation message to the server (if applicable depending on the protocol), and marks this operation as finished.
        Specified by:
        cancelMulti in interface WebSocketSubprotocolHandler
        Parameters:
        id - ID of the operation (returned from calling `executeMulti`)