public class WebSocketServerSockJsSession extends AbstractSockJsSession implements NativeWebSocketSession
DISCONNECTED_CLIENT_LOG_CATEGORY, disconnectedClientLogger, logger, responseLock| 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.
|
int |
getBinaryMessageSizeLimit()
Get the configured maximum size for an incoming binary message.
|
List<WebSocketExtension> |
getExtensions()
Determine the negotiated extensions.
|
HttpHeaders |
getHandshakeHeaders()
Return the headers used in the handshake request (never
null). |
InetSocketAddress |
getLocalAddress()
Return the address on which the request was received.
|
Object |
getNativeSession()
Return the underlying native WebSocketSession.
|
<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, getMessageCodec, 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, @Nullable Map<String,Object> attributes)
@Nullable public URI getUri()
WebSocketSessiongetUri in interface WebSocketSessionpublic HttpHeaders getHandshakeHeaders()
WebSocketSessionnull).getHandshakeHeaders 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()
WebSocketSessiongetAcceptedProtocol in interface WebSocketSessionnull if no protocol
was specified or negotiated successfullypublic 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()
WebSocketSessiongetExtensions in interface WebSocketSessionpublic Object getNativeSession()
NativeWebSocketSessiongetNativeSession in interface NativeWebSocketSession@Nullable public <T> T getNativeSession(@Nullable Class<T> requiredType)
NativeWebSocketSessiongetNativeSession in interface NativeWebSocketSessionrequiredType - the required type of the sessionnull if not availablepublic 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