public abstract class AbstractWebSocketSession<T> extends Object implements NativeWebSocketSession
WebSocketSession
.Constructor and Description |
---|
AbstractWebSocketSession(Map<String,Object> handshakeAttributes)
Class constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkNativeSessionInitialized() |
void |
close()
Close the WebSocket connection with status 1000, i.e.
|
void |
close(CloseStatus status)
Close the WebSocket connection with the given close status.
|
protected abstract void |
closeInternal(CloseStatus status) |
Map<String,Object> |
getHandshakeAttributes()
Handshake request specific attributes.
|
T |
getNativeSession()
Return the underlying native WebSocketSession, if available.
|
<R> R |
getNativeSession(Class<R> requiredType)
Return the underlying native WebSocketSession, if available.
|
void |
initializeNativeSession(T session) |
protected abstract void |
sendBinaryMessage(BinaryMessage message) |
void |
sendMessage(WebSocketMessage<?> message)
Send a WebSocket message either
TextMessage or
BinaryMessage . |
protected abstract void |
sendPingMessage(PingMessage message) |
protected abstract void |
sendPongMessage(PongMessage message) |
protected abstract void |
sendTextMessage(TextMessage message) |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getAcceptedProtocol, getExtensions, getHandshakeHeaders, getId, getLocalAddress, getPrincipal, getRemoteAddress, getUri, isOpen
protected final Log logger
public Map<String,Object> getHandshakeAttributes()
WebSocketSession
HandshakeInterceptor
.getHandshakeAttributes
in interface WebSocketSession
public T getNativeSession()
NativeWebSocketSession
getNativeSession
in interface NativeWebSocketSession
null
public <R> R getNativeSession(Class<R> requiredType)
NativeWebSocketSession
getNativeSession
in interface NativeWebSocketSession
requiredType
- the required type of the sessionnull
public void initializeNativeSession(T session)
protected final void checkNativeSessionInitialized()
public final void sendMessage(WebSocketMessage<?> message) throws IOException
WebSocketSession
TextMessage
or
BinaryMessage
.sendMessage
in interface WebSocketSession
IOException
protected abstract void sendTextMessage(TextMessage message) throws IOException
IOException
protected abstract void sendBinaryMessage(BinaryMessage message) throws IOException
IOException
protected abstract void sendPingMessage(PingMessage message) throws IOException
IOException
protected abstract void sendPongMessage(PongMessage message) throws IOException
IOException
public final void close() throws IOException
WebSocketSession
session.close(CloseStatus.NORMAL);
close
in interface WebSocketSession
IOException
public final void close(CloseStatus status) throws IOException
WebSocketSession
close
in interface WebSocketSession
IOException
protected abstract void closeInternal(CloseStatus status) throws IOException
IOException