T
- ネイティブセッション型 public abstract class AbstractWebSocketSession<T> extends ObjectSE implements NativeWebSocketSession
WebSocketSession
の実装の抽象基本クラス。修飾子と型 | フィールドと説明 |
---|---|
protected static IdGenerator | idGenerator |
protected static Log | logger |
コンストラクターと説明 |
---|
AbstractWebSocketSession(MapSE<StringSE, ObjectSE> attributes) 新しいインスタンスを作成し、指定された属性をそれに関連付けます。 |
修飾子と型 | メソッドと説明 |
---|---|
protected void | checkNativeSessionInitialized() |
void | close() ステータス 1000 で WebSocket 接続を閉じます。 |
void | close(CloseStatus status) 指定されたクローズ状態で WebSocket 接続を閉じます。 |
protected abstract void | closeInternal(CloseStatus status) |
MapSE<StringSE, ObjectSE> | getAttributes() WebSocket セッションに関連付けられた属性を持つマップを返します。 |
T | getNativeSession() 基礎となるネイティブ WebSocketSession を返します。 |
<R> R | getNativeSession(ClassSE<R> requiredType) 使用可能な場合、基礎となるネイティブ WebSocketSession を返します。 |
void | initializeNativeSession(T session) |
protected abstract void | sendBinaryMessage(BinaryMessage message) |
void | sendMessage(WebSocketMessage<?> message) WebSocket メッセージを送信する: TextMessage または BinaryMessage のいずれか。 |
protected abstract void | sendPingMessage(PingMessage message) |
protected abstract void | sendPongMessage(PongMessage message) |
protected abstract void | sendTextMessage(TextMessage message) |
StringSE | toString() |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSE
getAcceptedProtocol, getBinaryMessageSizeLimit, getExtensions, getHandshakeHeaders, getId, getLocalAddress, getPrincipal, getRemoteAddress, getTextMessageSizeLimit, getUri, isOpen, setBinaryMessageSizeLimit, setTextMessageSizeLimit
protected static final IdGenerator idGenerator
protected static final Log logger
public MapSE<StringSE,ObjectSE> getAttributes()
WebSocketSession
サーバー側では、最初に HandshakeInterceptor
を介してマップにデータを入力できます。クライアント側では、WebSocketClient
ハンドシェイクメソッドを介してマップにデータを入力できます。
WebSocketSession
の getAttributes
null
)public T getNativeSession()
NativeWebSocketSession
NativeWebSocketSession
の getNativeSession
@Nullable public <R> R getNativeSession(@Nullable ClassSE<R> requiredType)
NativeWebSocketSession
NativeWebSocketSession
の getNativeSession
requiredType
- 必要なセッションの型 null
public void initializeNativeSession(T session)
protected final void checkNativeSessionInitialized()
public final void sendMessage(WebSocketMessage<?> message) throws IOExceptionSE
WebSocketSession
TextMessage
または BinaryMessage
のいずれか。 注意 : 基礎となる標準 WebSocket セッション(JSR-356)は同時送信を許可しません。送信を同期する必要があります。これを確実にするための 1 つのオプションは、WebSocketSession
を ConcurrentWebSocketSessionDecorator
でラップすることです。
WebSocketSession
の sendMessage
IOExceptionSE
ConcurrentWebSocketSessionDecorator
protected abstract void sendTextMessage(TextMessage message) throws IOExceptionSE
protected abstract void sendBinaryMessage(BinaryMessage message) throws IOExceptionSE
protected abstract void sendPingMessage(PingMessage message) throws IOExceptionSE
protected abstract void sendPongMessage(PongMessage message) throws IOExceptionSE
public final void close() throws IOExceptionSE
WebSocketSession
session.close(CloseStatus.NORMAL);
CloseableSE
の closeSE
AutoCloseableSE
の closeSE
WebSocketSession
の close
IOExceptionSE
public final void close(CloseStatus status) throws IOExceptionSE
WebSocketSession
WebSocketSession
の close
IOExceptionSE
protected abstract void closeInternal(CloseStatus status) throws IOExceptionSE
public StringSE toString()
ObjectSE
の toStringSE