public interface WebSocketGraphQlInterceptor extends WebGraphQlInterceptor
WebGraphQlInterceptor
with additional methods
to handle the start and end of a WebSocket connection. Only a single
interceptor of type WebSocketGraphQlInterceptor
may be
declared.WebGraphQlInterceptor.Chain
Modifier and Type | Method and Description |
---|---|
default reactor.core.publisher.Mono<Void> |
handleCancelledSubscription(WebSocketSessionInfo sessionInfo,
String subscriptionId)
Handle the
"complete" message that a client sends to stop a
subscription stream. |
default void |
handleConnectionClosed(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 a
ExecutionGraphQlService . |
andThen, apply
default reactor.core.publisher.Mono<WebGraphQlResponse> intercept(WebGraphQlRequest request, WebGraphQlInterceptor.Chain chain)
WebGraphQlInterceptor
ExecutionGraphQlService
.intercept
in interface WebGraphQlInterceptor
request
- the request which may be a WebSocketGraphQlRequest
when intercepting a GraphQL request over WebSocketchain
- the rest of the chain to execute the requestMono
with the responsedefault reactor.core.publisher.Mono<Object> handleConnectionInitialization(WebSocketSessionInfo sessionInfo, Map<String,Object> connectionInitPayload)
"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.sessionInfo
- information about the underlying WebSocket sessionconnectionInitPayload
- the payload from the "connection_init"
message"connection_ack"
, or emptydefault reactor.core.publisher.Mono<Void> handleCancelledSubscription(WebSocketSessionInfo sessionInfo, String subscriptionId)
"complete"
message that a client sends to stop a
subscription stream. The underlying Publisher
for the subscription is automatically cancelled. This callback is for any
additional, or more centralized handling across subscriptions.sessionInfo
- information about the underlying WebSocket sessionsubscriptionId
- the unique id for the subscription; correlates to the
requestId
from the original "subscribe"
message that started the subscriptionMono
for the completion of handlingdefault void handleConnectionClosed(WebSocketSessionInfo sessionInfo, int statusCode, Map<String,Object> connectionInitPayload)
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