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, 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, @Nullable Map<String,Object> attributes)
@Nullable public URI getUri()
WebSocketSession
getUri
in interface WebSocketSession
public HttpHeaders getHandshakeHeaders()
WebSocketSession
null
).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
getAcceptedProtocol
in interface WebSocketSession
null
if no protocol
was specified or negotiated successfullypublic 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
getExtensions
in interface WebSocketSession
public Object getNativeSession()
NativeWebSocketSession
getNativeSession
in interface NativeWebSocketSession
@Nullable public <T> T getNativeSession(@Nullable Class<T> requiredType)
NativeWebSocketSession
getNativeSession
in interface NativeWebSocketSession
requiredType
- the required type of the sessionnull
if not availablepublic 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