Class GraphQlWebSocketHandler
java.lang.Object
org.springframework.web.socket.handler.AbstractWebSocketHandler
org.springframework.web.socket.handler.TextWebSocketHandler
com.graphql_java_generator.server.util.GraphQlWebSocketHandler
- All Implemented Interfaces:
org.springframework.web.socket.SubProtocolCapable,org.springframework.web.socket.WebSocketHandler
public class GraphQlWebSocketHandler
extends org.springframework.web.socket.handler.TextWebSocketHandler
implements org.springframework.web.socket.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
-
Field Summary
Fields Modifier and Type Field Description static intBUFFER_SIZE_LIMITSize of the buffer (number of bytes), where subscription messages are stored, if they can't be stored immediatelystatic intSEND_TIME_LIMITMaximum allowed duration (milliseconds) to send a message for a subscription, when the web socket is busy -
Constructor Summary
Constructors Constructor Description GraphQlWebSocketHandler(graphql.schema.GraphQLSchema graphQLSchema)Create a new instance. -
Method Summary
Modifier and Type Method Description voidafterConnectionClosed(org.springframework.web.socket.WebSocketSession session, org.springframework.web.socket.CloseStatus closeStatus)voidafterConnectionEstablished(org.springframework.web.socket.WebSocketSession session)java.util.List<java.lang.String>getSubProtocols()protected voidhandleTextMessage(org.springframework.web.socket.WebSocketSession sessionParam, org.springframework.web.socket.TextMessage message)voidhandleTransportError(org.springframework.web.socket.WebSocketSession session, java.lang.Throwable exception)booleansupportsPartialMessages()Methods inherited from class org.springframework.web.socket.handler.TextWebSocketHandler
handleBinaryMessage
-
Field Details
-
SEND_TIME_LIMIT
public static final int SEND_TIME_LIMITMaximum allowed duration (milliseconds) to send a message for a subscription, when the web socket is busy- See Also:
ConcurrentWebSocketSessionDecorator(WebSocketSession, int, int, org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator.OverflowStrategy), Constant Field Values
-
BUFFER_SIZE_LIMIT
public static final int BUFFER_SIZE_LIMITSize of the buffer (number of bytes), where subscription messages are stored, if they can't be stored immediately- See Also:
ConcurrentWebSocketSessionDecorator, Constant Field Values
-
-
Constructor Details
-
GraphQlWebSocketHandler
public GraphQlWebSocketHandler(graphql.schema.GraphQLSchema graphQLSchema)Create a new instance.
-
-
Method Details
-
getSubProtocols
public java.util.List<java.lang.String> getSubProtocols()- Specified by:
getSubProtocolsin interfaceorg.springframework.web.socket.SubProtocolCapable
-
afterConnectionEstablished
public void afterConnectionEstablished(org.springframework.web.socket.WebSocketSession session)- Specified by:
afterConnectionEstablishedin interfaceorg.springframework.web.socket.WebSocketHandler- Overrides:
afterConnectionEstablishedin classorg.springframework.web.socket.handler.AbstractWebSocketHandler
-
handleTextMessage
protected void handleTextMessage(org.springframework.web.socket.WebSocketSession sessionParam, org.springframework.web.socket.TextMessage message) throws java.lang.Exception- Overrides:
handleTextMessagein classorg.springframework.web.socket.handler.AbstractWebSocketHandler- Throws:
java.lang.Exception
-
handleTransportError
public void handleTransportError(org.springframework.web.socket.WebSocketSession session, java.lang.Throwable exception)- Specified by:
handleTransportErrorin interfaceorg.springframework.web.socket.WebSocketHandler- Overrides:
handleTransportErrorin classorg.springframework.web.socket.handler.AbstractWebSocketHandler
-
afterConnectionClosed
public void afterConnectionClosed(org.springframework.web.socket.WebSocketSession session, org.springframework.web.socket.CloseStatus closeStatus)- Specified by:
afterConnectionClosedin interfaceorg.springframework.web.socket.WebSocketHandler- Overrides:
afterConnectionClosedin classorg.springframework.web.socket.handler.AbstractWebSocketHandler
-
supportsPartialMessages
public boolean supportsPartialMessages()- Specified by:
supportsPartialMessagesin interfaceorg.springframework.web.socket.WebSocketHandler- Overrides:
supportsPartialMessagesin classorg.springframework.web.socket.handler.AbstractWebSocketHandler
-