Class GraphQlWebSocketHandler
java.lang.Object
org.springframework.web.socket.handler.AbstractWebSocketHandler
org.springframework.web.socket.handler.TextWebSocketHandler
org.springframework.graphql.server.webmvc.GraphQlWebSocketHandler
- All Implemented Interfaces:
 SubProtocolCapable,WebSocketHandler
@RegisterReflectionForBinding(GraphQlWebSocketMessage.class)
public class GraphQlWebSocketHandler
extends TextWebSocketHandler
implements SubProtocolCapable
WebSocketHandler for GraphQL based on
 GraphQL Over
 WebSocket Protocol and for use on a Servlet container with
 
spring-websocket.- Since:
 - 1.0.0
 - Author:
 - Rossen Stoyanchev
 
- 
Constructor Summary
ConstructorsConstructorDescriptionGraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, HttpMessageConverter<Object> converter, Duration connectionInitTimeout) Create a new instance.GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, HttpMessageConverter<Object> converter, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration) Create a new instance. - 
Method Summary
Modifier and TypeMethodDescriptionvoidafterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) voidprotected voidhandleTextMessage(WebSocketSession session, TextMessage webSocketMessage) initWebSocketHttpRequestHandler(HandshakeHandler handshakeHandler) Initialize aWebSocketHttpRequestHandlerthat wraps this instance and also inserts aHandshakeInterceptorfor context propagation.Methods inherited from class org.springframework.web.socket.handler.TextWebSocketHandler
handleBinaryMessageMethods inherited from class org.springframework.web.socket.handler.AbstractWebSocketHandler
handleMessage, handlePongMessage, handleTransportError, supportsPartialMessages 
- 
Constructor Details
- 
GraphQlWebSocketHandler
public GraphQlWebSocketHandler(WebGraphQlHandler graphQlHandler, HttpMessageConverter<Object> converter, Duration connectionInitTimeout) Create a new instance.- Parameters:
 graphQlHandler- common handler for GraphQL over WebSocket requestsconverter- 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, HttpMessageConverter<Object> converter, Duration connectionInitTimeout, @Nullable Duration keepAliveDuration) Create a new instance.- Parameters:
 graphQlHandler- common handler for GraphQL over WebSocket requestsconverter- 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
 
 
 - 
 - 
Method Details
- 
getSubProtocols
- Specified by:
 getSubProtocolsin interfaceSubProtocolCapable
 - 
initWebSocketHttpRequestHandler
public WebSocketHttpRequestHandler initWebSocketHttpRequestHandler(HandshakeHandler handshakeHandler) Initialize aWebSocketHttpRequestHandlerthat wraps this instance and also inserts aHandshakeInterceptorfor context propagation.- Parameters:
 handshakeHandler- the handler for WebSocket handshake- Since:
 - 1.1.0
 
 - 
afterConnectionEstablished
- Specified by:
 afterConnectionEstablishedin interfaceWebSocketHandler- Overrides:
 afterConnectionEstablishedin classAbstractWebSocketHandler
 - 
handleTextMessage
protected void handleTextMessage(WebSocketSession session, TextMessage webSocketMessage) throws Exception - Overrides:
 handleTextMessagein classAbstractWebSocketHandler- Throws:
 Exception
 - 
afterConnectionClosed
- Specified by:
 afterConnectionClosedin interfaceWebSocketHandler- Overrides:
 afterConnectionClosedin classAbstractWebSocketHandler
 
 -