public class WebSocketServerSockJsSession extends AbstractSockJsSession implements WebSocketSession, NativeWebSocketSession
logger| Constructor and Description |
|---|
WebSocketServerSockJsSession(String id,
SockJsServiceConfig config,
WebSocketHandler wsHandler,
Map<String,Object> attributes) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
disconnect(CloseStatus status) |
String |
getAcceptedProtocol()
Return the negotiated sub-protocol or
null if none was specified or
negotiated successfully. |
List<WebSocketExtension> |
getExtensions()
Return the negotiated extensions or
null if none was specified or
negotiated successfully. |
HttpHeaders |
getHandshakeHeaders()
Return the headers used in the handshake request.
|
InetSocketAddress |
getLocalAddress()
Return the address on which the request was received.
|
Object |
getNativeSession()
Return the underlying native WebSocketSession, if available.
|
<T> T |
getNativeSession(Class<T> requiredType)
Return the underlying native WebSocketSession, if available.
|
Principal |
getPrincipal()
Return a
Principal instance containing the name of the
authenticated user. |
InetSocketAddress |
getRemoteAddress()
Return the address of the remote client.
|
URI |
getUri()
Return the URI used to open the WebSocket connection.
|
void |
handleMessage(TextMessage message,
WebSocketSession wsSession) |
void |
initializeDelegateSession(WebSocketSession session) |
boolean |
isActive()
Polling and Streaming sessions periodically close the current HTTP request and
wait for the next request to come through.
|
void |
sendMessageInternal(String message) |
protected void |
writeFrameInternal(SockJsFrame frame) |
cancelHeartbeat, close, close, delegateConnectionClosed, delegateConnectionEstablished, delegateError, delegateMessages, getHandshakeAttributes, getId, getSockJsServiceConfig, getTimeSinceLastActive, isClosed, isNew, isOpen, scheduleHeartbeat, sendHeartbeat, sendMessage, toString, tryCloseWithSockJsTransportError, updateLastActiveTime, writeFrameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, close, getHandshakeAttributes, getId, isOpen, sendMessagepublic WebSocketServerSockJsSession(String id, SockJsServiceConfig config, WebSocketHandler wsHandler, Map<String,Object> attributes)
public URI getUri()
WebSocketSessiongetUri in interface WebSocketSessionpublic HttpHeaders getHandshakeHeaders()
WebSocketSessiongetHandshakeHeaders in interface WebSocketSessionpublic Principal getPrincipal()
WebSocketSessionPrincipal instance containing the name of the
authenticated user. If the user has not been authenticated, the method returns
null.getPrincipal in interface WebSocketSessionpublic InetSocketAddress getLocalAddress()
WebSocketSessiongetLocalAddress in interface WebSocketSessionpublic InetSocketAddress getRemoteAddress()
WebSocketSessiongetRemoteAddress in interface WebSocketSessionpublic String getAcceptedProtocol()
WebSocketSessionnull if none was specified or
negotiated successfully.getAcceptedProtocol in interface WebSocketSessionpublic List<WebSocketExtension> getExtensions()
WebSocketSessionnull if none was specified or
negotiated successfully.getExtensions in interface WebSocketSessionpublic Object getNativeSession()
NativeWebSocketSessiongetNativeSession in interface NativeWebSocketSessionnullpublic <T> T getNativeSession(Class<T> requiredType)
NativeWebSocketSessiongetNativeSession in interface NativeWebSocketSessionrequiredType - the required type of the sessionnullpublic void initializeDelegateSession(WebSocketSession session)
public boolean isActive()
AbstractSockJsSessionisActive in class AbstractSockJsSessionpublic void handleMessage(TextMessage message, WebSocketSession wsSession) throws Exception
Exceptionpublic void sendMessageInternal(String message) throws SockJsTransportFailureException
sendMessageInternal in class AbstractSockJsSessionSockJsTransportFailureExceptionprotected void writeFrameInternal(SockJsFrame frame) throws IOException
writeFrameInternal in class AbstractSockJsSessionIOExceptionprotected void disconnect(CloseStatus status) throws IOException
disconnect in class AbstractSockJsSessionIOException