Class GraphQlWebSocketHandler
java.lang.Object
org.springframework.graphql.server.webflux.GraphQlWebSocketHandler
- All Implemented Interfaces:
WebSocketHandler
@RegisterReflectionForBinding(GraphQlWebSocketMessage.class)
public class GraphQlWebSocketHandler
extends Object
implements WebSocketHandler
WebSocketHandler for GraphQL based on
GraphQL Over
WebSocket Protocol and for use in a Spring WebFlux application.
- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
-
Constructor Summary
ConstructorDescriptionGraphQlWebSocketHandler
(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout) Create a new instance.GraphQlWebSocketHandler
(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, Duration keepAliveDuration) Create a new instance. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>
handle
(WebSocketSession session)
-
Constructor Details
-
GraphQlWebSocketHandler
public GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout) Create a new instance.- Parameters:
graphQlHandler
- common handler for GraphQL over WebSocket requestscodecConfigurer
- codec configurer for JSON encoding and decodingconnectionInitTimeout
- how long to wait after the establishment of the WebSocket for the"connection_ini"
message from the client.
-
GraphQlWebSocketHandler
public GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration) Create a new instance.- Parameters:
graphQlHandler
- common handler for GraphQL over WebSocket requestscodecConfigurer
- codec configurer for JSON encoding and decodingconnectionInitTimeout
- how long to wait after the establishment of the WebSocket for the"connection_ini"
message from the client.keepAliveDuration
- how frequently to send ping messages; if not set then ping messages are not sent.- Since:
- 1.3
-
-
Method Details
-
getSubProtocols
- Specified by:
getSubProtocols
in interfaceWebSocketHandler
-
handle
- Specified by:
handle
in interfaceWebSocketHandler
-