public class WebSocketTransportHandler extends java.lang.Object implements ConfigurableTransportHandler, HandshakeHandler, SockJsSessionFactory
TransportHandler. Uses SockJsWebSocketHandler and
WebSocketServerSockJsSession to add SockJS processing.
Also implements HandshakeHandler to support raw WebSocket communication at
SockJS URL "/websocket".
| Constructor and Description |
|---|
WebSocketTransportHandler(HandshakeHandler handshakeHandler) |
| Modifier and Type | Method and Description |
|---|---|
AbstractSockJsSession |
createSession(java.lang.String sessionId,
WebSocketHandler webSocketHandler)
Create a new SockJS session.
|
boolean |
doHandshake(ServerHttpRequest request,
ServerHttpResponse response,
WebSocketHandler handler)
Initiate the handshake.
|
TransportType |
getTransportType() |
void |
handleRequest(ServerHttpRequest request,
ServerHttpResponse response,
WebSocketHandler webSocketHandler,
AbstractSockJsSession session) |
void |
setSockJsConfiguration(SockJsConfiguration sockJsConfig) |
public WebSocketTransportHandler(HandshakeHandler handshakeHandler)
public TransportType getTransportType()
getTransportType in interface TransportHandlerpublic void setSockJsConfiguration(SockJsConfiguration sockJsConfig)
setSockJsConfiguration in interface ConfigurableTransportHandlerpublic AbstractSockJsSession createSession(java.lang.String sessionId, WebSocketHandler webSocketHandler)
SockJsSessionFactorycreateSession in interface SockJsSessionFactorysessionId - the ID of the sessionwebSocketHandler - the underlying WebSocketHandlerpublic void handleRequest(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler webSocketHandler, AbstractSockJsSession session) throws TransportErrorException
handleRequest in interface TransportHandlerTransportErrorExceptionpublic boolean doHandshake(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler handler) throws java.io.IOException
HandshakeHandlerdoHandshake in interface HandshakeHandlerrequest - the current requestresponse - the current responsehandler - the handler to process WebSocket messages; see
PerConnectionWebSocketHandler for providing a handler with
per-connection lifecycle.java.io.IOException - thrown when accessing or setting the response