public interface WebSocketSession
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 or
null if none was specified or
negotiated successfully. |
List<WebSocketExtension> |
getExtensions()
Return the negotiated extensions or
null if none was specified or
negotiated successfully. |
Map<String,Object> |
getHandshakeAttributes()
Handshake request specific attributes.
|
HttpHeaders |
getHandshakeHeaders()
Return the headers used in the handshake request.
|
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.
|
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 . |
String getId()
URI getUri()
HttpHeaders getHandshakeHeaders()
Map<String,Object> getHandshakeAttributes()
HandshakeInterceptor
.Principal getPrincipal()
Principal
instance containing the name of the
authenticated user. If the user has not been authenticated, the method returns
null
.InetSocketAddress getLocalAddress()
InetSocketAddress getRemoteAddress()
String getAcceptedProtocol()
null
if none was specified or
negotiated successfully.List<WebSocketExtension> getExtensions()
null
if none was specified or
negotiated successfully.boolean isOpen()
void sendMessage(WebSocketMessage<?> message) throws IOException
TextMessage
or
BinaryMessage
.IOException
void close() throws IOException
session.close(CloseStatus.NORMAL);
IOException
void close(CloseStatus status) throws IOException
IOException