public interface WebSocketSession extends Closeable
| Modifier and Type | Method and Description | 
|---|---|
void | 
close()
Close the WebSocket connection with status 1000, i.e. 
 | 
void | 
close(CloseStatus status)
Close the WebSocket connection with the given close status. 
 | 
String | 
getAcceptedProtocol()
Return the negotiated sub-protocol. 
 | 
Map<String,Object> | 
getAttributes()
Return the map with attributes associated with the WebSocket session. 
 | 
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). | 
String | 
getId()
Return a unique session identifier. 
 | 
InetSocketAddress | 
getLocalAddress()
Return the address on which the request was received. 
 | 
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. 
 | 
boolean | 
isOpen()
Return whether the connection is still open. 
 | 
void | 
sendMessage(WebSocketMessage<?> message)
Send a WebSocket message: either  
TextMessage or BinaryMessage. | 
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. 
 | 
String getId()
HttpHeaders getHandshakeHeaders()
null).Map<String,Object> getAttributes()
On the server side the map can be populated initially through a
 HandshakeInterceptor. On the client side the map can be populated via
 WebSocketClient handshake methods.
null)@Nullable Principal getPrincipal()
Principal instance containing the name
 of the authenticated user.
 If the user has not been authenticated, the method returns null.
@Nullable InetSocketAddress getLocalAddress()
@Nullable InetSocketAddress getRemoteAddress()
@Nullable String getAcceptedProtocol()
null if no protocol
 was specified or negotiated successfullyvoid setTextMessageSizeLimit(int messageSizeLimit)
int getTextMessageSizeLimit()
void setBinaryMessageSizeLimit(int messageSizeLimit)
int getBinaryMessageSizeLimit()
List<WebSocketExtension> getExtensions()
void sendMessage(WebSocketMessage<?> message) throws IOException
TextMessage or BinaryMessage.
 Note: The underlying standard WebSocket session (JSR-356) does
 not allow concurrent sending. Therefore sending must be synchronized. To ensure
 that, one option is to wrap the WebSocketSession with the
 ConcurrentWebSocketSessionDecorator.
IOExceptionConcurrentWebSocketSessionDecoratorboolean isOpen()
void close()
    throws IOException
session.close(CloseStatus.NORMAL);
close in interface AutoCloseableclose in interface CloseableIOExceptionvoid close(CloseStatus status) throws IOException
IOException