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. |
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, getMessageCodec, getSockJsServiceConfig, getTimeSinceLastActive, isClosed, isNew, isOpen, scheduleHeartbeat, sendHeartbeat, sendMessage, toString, tryCloseWithSockJsTransportError, updateLastActiveTime, writeFrame
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close, close, getAttributes, getId, isOpen, sendMessage
public WebSocketServerSockJsSession(String id, SockJsServiceConfig config, WebSocketHandler handler, Map<String,Object> attributes)
public URI getUri()
WebSocketSession
getUri
in interface WebSocketSession
public HttpHeaders getHandshakeHeaders()
WebSocketSession
getHandshakeHeaders
in interface WebSocketSession
public Principal getPrincipal()
WebSocketSession
Principal
instance containing the name of the
authenticated user.
If the user has not been authenticated, the method returns null
.
getPrincipal
in interface WebSocketSession
public InetSocketAddress getLocalAddress()
WebSocketSession
getLocalAddress
in interface WebSocketSession
public InetSocketAddress getRemoteAddress()
WebSocketSession
getRemoteAddress
in interface WebSocketSession
public String getAcceptedProtocol()
WebSocketSession
null
if none was specified or
negotiated successfully.getAcceptedProtocol
in interface WebSocketSession
public void setTextMessageSizeLimit(int messageSizeLimit)
WebSocketSession
setTextMessageSizeLimit
in interface WebSocketSession
public int getTextMessageSizeLimit()
WebSocketSession
getTextMessageSizeLimit
in interface WebSocketSession
public void setBinaryMessageSizeLimit(int messageSizeLimit)
WebSocketSession
setBinaryMessageSizeLimit
in interface WebSocketSession
public int getBinaryMessageSizeLimit()
WebSocketSession
getBinaryMessageSizeLimit
in interface WebSocketSession
public List<WebSocketExtension> getExtensions()
WebSocketSession
null
if none was specified or
negotiated successfully.getExtensions
in interface WebSocketSession
public Object getNativeSession()
NativeWebSocketSession
getNativeSession
in interface NativeWebSocketSession
null
public <T> T getNativeSession(Class<T> requiredType)
NativeWebSocketSession
getNativeSession
in interface NativeWebSocketSession
requiredType
- the required type of the sessionnull
public void initializeDelegateSession(WebSocketSession session)
public boolean isActive()
AbstractSockJsSession
isActive
in class AbstractSockJsSession
public void handleMessage(TextMessage message, WebSocketSession wsSession) throws Exception
Exception
public void sendMessageInternal(String message) throws SockJsTransportFailureException
sendMessageInternal
in class AbstractSockJsSession
SockJsTransportFailureException
protected void writeFrameInternal(SockJsFrame frame) throws IOException
writeFrameInternal
in class AbstractSockJsSession
IOException
protected void disconnect(CloseStatus status) throws IOException
AbstractSockJsSession
disconnect
in class AbstractSockJsSession
IOException