public class WebSocketServerSockJsSession extends AbstractSockJsSession implements NativeWebSocketSession
DISCONNECTED_CLIENT_LOG_CATEGORY, disconnectedClientLogger, logger| Constructor and Description |
|---|
WebSocketServerSockJsSession(String id,
SockJsServiceConfig config,
WebSocketHandler handler,
Map<String,Object> attributes) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
disconnect(CloseStatus status)
Actually close the underlying WebSocket session or in the case of HTTP
transports complete the underlying request.
|
String |
getAcceptedProtocol()
Return the negotiated sub-protocol or
null if none was specified or
negotiated successfully. |
int |
getBinaryMessageSizeLimit()
Get the configured maximum size for an incoming binary message.
|
List<WebSocketExtension> |
getExtensions()
Return the negotiated extensions or
null if none was specified or
negotiated successfully. |
org.springframework.http.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.
|
int |
getTextMessageSizeLimit()
Get the configured maximum size for an incoming text message.
|
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) |
void |
setBinaryMessageSizeLimit(int messageSizeLimit)
Configure the maximum size for an incoming binary message.
|
void |
setTextMessageSizeLimit(int messageSizeLimit)
Configure the maximum size for an incoming text message.
|
protected void |
writeFrameInternal(SockJsFrame frame) |
cancelHeartbeat, close, close, delegateConnectionClosed, delegateConnectionEstablished, delegateError, delegateMessages, disableHeartbeat, getAttributes, getId, getSockJsServiceConfig, getTimeSinceLastActive, isClosed, isNew, isOpen, scheduleHeartbeat, sendHeartbeat, sendMessage, toString, tryCloseWithSockJsTransportError, updateLastActiveTime, writeFrameclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclose, close, getAttributes, getId, isOpen, sendMessagepublic WebSocketServerSockJsSession(String id, SockJsServiceConfig config, WebSocketHandler handler, Map<String,Object> attributes)
public URI getUri()
WebSocketSessiongetUri in interface WebSocketSessionpublic org.springframework.http.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 void setTextMessageSizeLimit(int messageSizeLimit)
WebSocketSessionsetTextMessageSizeLimit in interface WebSocketSessionpublic int getTextMessageSizeLimit()
WebSocketSessiongetTextMessageSizeLimit in interface WebSocketSessionpublic void setBinaryMessageSizeLimit(int messageSizeLimit)
WebSocketSessionsetBinaryMessageSizeLimit in interface WebSocketSessionpublic int getBinaryMessageSizeLimit()
WebSocketSessiongetBinaryMessageSizeLimit 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
AbstractSockJsSessiondisconnect in class AbstractSockJsSessionIOException