Class GraphQLTransportWSSubprotocolHandler
- java.lang.Object
-
- io.smallrye.graphql.client.vertx.websocket.graphqltransportws.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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelMulti(String id)Cancels an active subscription with the given ID.voidcancelUni(String id)Cancels an active single-result operation with the given ID.voidclose()Called when the websocket should be closed (for example, when the GraphQL client is being closed).io.smallrye.mutiny.Uni<Void>ensureInitialized()This is called to initialize the websocket connection and prepare it for executing operations.StringexecuteMulti(jakarta.json.JsonObject request, io.smallrye.mutiny.subscription.MultiEmitter<? super String> emitter)Requests an execution of a subscription operation over the websocket.StringexecuteUni(jakarta.json.JsonObject request, io.smallrye.mutiny.subscription.UniEmitter<? super String> emitter)Requests an execution of a single-result operation over the websocket.
-
-
-
Method Detail
-
ensureInitialized
public io.smallrye.mutiny.Uni<Void> ensureInitialized()
Description copied from interface:WebSocketSubprotocolHandlerThis 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:
ensureInitializedin interfaceWebSocketSubprotocolHandler
-
executeUni
public String executeUni(jakarta.json.JsonObject request, io.smallrye.mutiny.subscription.UniEmitter<? super String> emitter)
Description copied from interface:WebSocketSubprotocolHandlerRequests an execution of a single-result operation over the websocket.- Specified by:
executeUniin interfaceWebSocketSubprotocolHandler- 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(jakarta.json.JsonObject request, io.smallrye.mutiny.subscription.MultiEmitter<? super String> emitter)
Description copied from interface:WebSocketSubprotocolHandlerRequests an execution of a subscription operation over the websocket.- Specified by:
executeMultiin interfaceWebSocketSubprotocolHandler- 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:WebSocketSubprotocolHandlerCancels 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:
cancelUniin interfaceWebSocketSubprotocolHandler- Parameters:
id- ID of the operation (returned from calling `executeUni`)
-
cancelMulti
public void cancelMulti(String id)
Description copied from interface:WebSocketSubprotocolHandlerCancels 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:
cancelMultiin interfaceWebSocketSubprotocolHandler- Parameters:
id- ID of the operation (returned from calling `executeMulti`)
-
close
public void close()
Description copied from interface:WebSocketSubprotocolHandlerCalled when the websocket should be closed (for example, when the GraphQL client is being closed).- Specified by:
closein interfaceWebSocketSubprotocolHandler
-
-