Interface WebSocketGraphQlInterceptor
- All Superinterfaces:
WebGraphQlInterceptor
An extension of
WebGraphQlInterceptor with additional methods
to handle the start and end of a WebSocket connection. Only a single
interceptor of type WebSocketGraphQlInterceptor may be
declared.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.graphql.server.WebGraphQlInterceptor
WebGraphQlInterceptor.Chain -
Method Summary
Modifier and TypeMethodDescriptiondefault reactor.core.publisher.Mono<Void>handleCancelledSubscription(WebSocketSessionInfo sessionInfo, String subscriptionId) Handle the"complete"message that a client sends to stop a subscription stream.default voidhandleConnectionClosed(WebSocketSessionInfo sessionInfo, int statusCode, Map<String, Object> connectionInitPayload) Invoked when the WebSocket session is closed, from either side.default reactor.core.publisher.Mono<Object>handleConnectionInitialization(WebSocketSessionInfo sessionInfo, Map<String, Object> connectionInitPayload) Handle the"connection_init"message at the start of a GraphQL over WebSocket session and return an optional payload for the"connection_ack"message to send back.default reactor.core.publisher.Mono<WebGraphQlResponse>intercept(WebGraphQlRequest request, WebGraphQlInterceptor.Chain chain) Intercept a request and delegate to the rest of the chain including other interceptors and aExecutionGraphQlService.Methods inherited from interface org.springframework.graphql.server.WebGraphQlInterceptor
andThen, apply
-
Method Details
-
intercept
default reactor.core.publisher.Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, WebGraphQlInterceptor.Chain chain) Description copied from interface:WebGraphQlInterceptorIntercept a request and delegate to the rest of the chain including other interceptors and aExecutionGraphQlService.- Specified by:
interceptin interfaceWebGraphQlInterceptor- Parameters:
request- the request which may be aWebSocketGraphQlRequestwhen intercepting a GraphQL request over WebSocketchain- the rest of the chain to execute the request- Returns:
- a
Monowith the response
-
handleConnectionInitialization
default reactor.core.publisher.Mono<Object> handleConnectionInitialization(WebSocketSessionInfo sessionInfo, Map<String, Object> connectionInitPayload) Handle the"connection_init"message at the start of a GraphQL over WebSocket session and return an optional payload for the"connection_ack"message to send back.- Parameters:
sessionInfo- information about the underlying WebSocket sessionconnectionInitPayload- the payload from the"connection_init"message- Returns:
- the payload for the
"connection_ack", or empty
-
handleCancelledSubscription
default reactor.core.publisher.Mono<Void> handleCancelledSubscription(WebSocketSessionInfo sessionInfo, String subscriptionId) Handle the"complete"message that a client sends to stop a subscription stream. The underlyingPublisherfor the subscription is automatically cancelled. This callback is for any additional, or more centralized handling across subscriptions.- Parameters:
sessionInfo- information about the underlying WebSocket sessionsubscriptionId- the unique id for the subscription; correlates to therequestIdfrom the original"subscribe"message that started the subscription- Returns:
Monofor the completion of handling
-
handleConnectionClosed
default void handleConnectionClosed(WebSocketSessionInfo sessionInfo, int statusCode, Map<String, Object> connectionInitPayload) Invoked when the WebSocket session is closed, from either side.- Parameters:
sessionInfo- information about the underlying WebSocket sessionstatusCode- the WebSocket "close" status codeconnectionInitPayload- the payload from the"connect_init"message received at the start of the connection
-