public abstract class AbstractClientSockJsSession extends ObjectSE implements WebSocketSession
WebSocketSession の SockJS クライアント実装の基本クラス。受信 SockJS メッセージフレームの処理を提供し、ライフサイクルイベントとメッセージを(アプリケーション)WebSocketHandler に委譲します。サブクラスは、実際の送信と切断ロジックを実装します。| 修飾子 | コンストラクターと説明 |
|---|---|
protected | AbstractClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture) |
| 修飾子と型 | メソッドと説明 |
|---|---|
void | afterTransportClosed(CloseStatus closeStatus) |
void | close() ステータス 1000 で WebSocket 接続を閉じます。 |
void | close(CloseStatus status) 指定されたクローズ状態で WebSocket 接続を閉じます。 |
protected void | closeInternal(CloseStatus status) |
protected abstract void | disconnect(CloseStatus status) |
MapSE<StringSE, ObjectSE> | getAttributes()WebSocket セッションに関連付けられた属性を持つマップを返します。 |
HttpHeaders | getHandshakeHeaders() ハンドシェイクリクエストで使用されるヘッダーを返します(非 null)。 |
StringSE | getId() 一意のセッション識別子を返します。 |
SockJsMessageCodec | getMessageCodec() |
PrincipalSE | getPrincipal() 認証されたユーザーの名前を含む PrincipalSE インスタンスを返します。 |
URISE | getUri()WebSocket 接続を開くために使用される URI を返します。 |
WebSocketHandler | getWebSocketHandler() |
void | handleFrame(StringSE payload) |
void | handleTransportError(ThrowableSE error) |
boolean | isDisconnected() |
boolean | isOpen() 基になる接続が開いているかどうか。 |
protected abstract void | sendInternal(TextMessage textMessage) |
void | sendMessage(WebSocketMessage<?> message)WebSocket メッセージを送信する: TextMessage または BinaryMessage のいずれか。 |
StringSE | toString() |
cloneSE, equalsSE, finalizeSE, getClassSE, hashCodeSE, notifySE, notifyAllSE, waitSE, waitSE, waitSEgetAcceptedProtocol, getBinaryMessageSizeLimit, getExtensions, getLocalAddress, getRemoteAddress, getTextMessageSizeLimit, setBinaryMessageSizeLimit, setTextMessageSizeLimitprotected final Log logger
protected AbstractClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture)
public StringSE getId()
WebSocketSessionWebSocketSession の getId public URISE getUri()
WebSocketSessionWebSocketSession の getUri public HttpHeaders getHandshakeHeaders()
WebSocketSessionnull)。WebSocketSession の getHandshakeHeaders public MapSE<StringSE,ObjectSE> getAttributes()
WebSocketSession サーバー側では、最初に HandshakeInterceptor を介してマップにデータを入力できます。クライアント側では、WebSocketClient ハンドシェイクメソッドを介してマップにデータを入力できます。
WebSocketSession の getAttributes null)public PrincipalSE getPrincipal()
WebSocketSessionPrincipalSE インスタンスを返します。 ユーザーが認証されていない場合、メソッドは null を返します。
WebSocketSession の getPrincipal public SockJsMessageCodec getMessageCodec()
public WebSocketHandler getWebSocketHandler()
public boolean isOpen()
WebSocketSessionWebSocketSession の isOpen public boolean isDisconnected()
public final void sendMessage(WebSocketMessage<?> message) throws IOExceptionSE
WebSocketSessionTextMessage または BinaryMessage のいずれか。 注意 : 基盤となる標準の WebSocket セッション(JSR-356)では、同時送信は許可されていません。送信を同期する必要があります。これを確実にするための 1 つのオプションは、WebSocketSession を ConcurrentWebSocketSessionDecorator でラップすることです。
WebSocketSession の sendMessage IOExceptionSEConcurrentWebSocketSessionDecoratorprotected abstract void sendInternal(TextMessage textMessage) throws IOExceptionSE
public final void close()
throws IOExceptionSEWebSocketSessionsession.close(CloseStatus.NORMAL);
CloseableSE の closeSE AutoCloseableSE の closeSE WebSocketSession の close IOExceptionSEpublic final void close(CloseStatus status) throws IOExceptionSE
WebSocketSessionWebSocketSession の close IOExceptionSEprotected void closeInternal(CloseStatus status) throws IOExceptionSE
protected abstract void disconnect(CloseStatus status) throws IOExceptionSE
public void handleFrame(StringSE payload)
public void handleTransportError(ThrowableSE error)
public void afterTransportClosed(@Nullable CloseStatus closeStatus)
public StringSE toString()
ObjectSE の toStringSE