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
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionGraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout) Deprecated, for removal: This API element is subject to removal in a future version.GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler, CodecConfigurer, Duration)GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration, @Nullable CorsConfiguration corsConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler, CodecConfigurer, Duration) -
Method Summary
Modifier and TypeMethodDescriptionbuilder(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout) Create a builder for aGraphQlWebSocketHandler.@Nullable CorsConfigurationgetCorsConfiguration(ServerWebExchange exchange) reactor.core.publisher.Mono<Void> handle(WebSocketSession session)
-
Constructor Details
-
GraphQlWebSocketHandler
@Deprecated(since="2.1.0", forRemoval=true) public GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler, CodecConfigurer, Duration)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
@Deprecated(since="2.1.0", forRemoval=true) public GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler, CodecConfigurer, Duration)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
@Deprecated(since="2.1.0", forRemoval=true) public GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration, @Nullable CorsConfiguration corsConfiguration) Deprecated, for removal: This API element is subject to removal in a future version.since 2.1.0 in favor ofbuilder(WebGraphQlHandler, CodecConfigurer, Duration)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
-
builder
public static GraphQlWebSocketHandler.Builder builder(WebGraphQlHandler graphQlHandler, CodecConfigurer codecConfigurer, Duration connectionInitTimeout) Create a builder for aGraphQlWebSocketHandler.- 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.- Since:
- 2.1.0
-
getSubProtocols
- Specified by:
getSubProtocolsin interfaceWebSocketHandler
-
getCorsConfiguration
- Specified by:
getCorsConfigurationin interfaceCorsConfigurationSource
-
handle
- Specified by:
handlein interfaceWebSocketHandler
-
builder(WebGraphQlHandler, CodecConfigurer, Duration)