Class GraphQlWebSocketHandler
java.lang.Object
org.springframework.graphql.server.webflux.GraphQlWebSocketHandler
- All Implemented Interfaces:
CorsConfigurationSource,WebSocketHandler
@RegisterReflectionForBinding(GraphQlWebSocketMessage.class)
public class GraphQlWebSocketHandler
extends Object
implements WebSocketHandler, CorsConfigurationSource
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
ConstructorsConstructorDescriptionGraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout) Create a new instance.GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration) Create a new instance.GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration, @Nullable CorsConfiguration corsConfiguration) Create a new instance. -
Method Summary
Modifier and TypeMethodDescription@Nullable CorsConfigurationgetCorsConfiguration(ServerWebExchange exchange) reactor.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 when no other messages are sent- Since:
- 1.3.0
-
GraphQlWebSocketHandler
public GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration, @Nullable CorsConfiguration corsConfiguration) 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 when no other messages are sentcorsConfiguration- the CORS configuration to use, anullconfiguration means no CORS check.- Since:
- 1.4.6
-
-
Method Details
-
getSubProtocols
- Specified by:
getSubProtocolsin interfaceWebSocketHandler
-
getCorsConfiguration
- Specified by:
getCorsConfigurationin interfaceCorsConfigurationSource
-
handle
- Specified by:
handlein interfaceWebSocketHandler
-