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() 認証されたユーザーの名前を含む Principal SE インスタンスを返します。 |
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, waitSE
getAcceptedProtocol, getBinaryMessageSizeLimit, getExtensions, getLocalAddress, getRemoteAddress, getTextMessageSizeLimit, setBinaryMessageSizeLimit, setTextMessageSizeLimit
protected final Log logger
protected AbstractClientSockJsSession(TransportRequest request, WebSocketHandler handler, SettableListenableFuture<WebSocketSession> connectFuture)
public StringSE getId()
WebSocketSession
WebSocketSession
の getId
public URISE getUri()
WebSocketSession
WebSocketSession
の getUri
public HttpHeaders getHandshakeHeaders()
WebSocketSession
null
)。WebSocketSession
の getHandshakeHeaders
public MapSE<StringSE,ObjectSE> getAttributes()
WebSocketSession
サーバー側では、最初に HandshakeInterceptor
を介してマップにデータを入力できます。クライアント側では、WebSocketClient
ハンドシェイクメソッドを介してマップにデータを入力できます。
WebSocketSession
の getAttributes
null
)public PrincipalSE getPrincipal()
WebSocketSession
Principal
SE インスタンスを返します。 ユーザーが認証されていない場合、メソッドは null
を返します。
WebSocketSession
の getPrincipal
public SockJsMessageCodec getMessageCodec()
public WebSocketHandler getWebSocketHandler()
public boolean isOpen()
WebSocketSession
WebSocketSession
の isOpen
public boolean isDisconnected()
public final void sendMessage(WebSocketMessage<?> message) throws IOExceptionSE
WebSocketSession
TextMessage
または BinaryMessage
のいずれか。 注意 : 基礎となる標準 WebSocket セッション(JSR-356)は同時送信を許可しません。送信を同期する必要があります。これを確実にするための 1 つのオプションは、WebSocketSession
を ConcurrentWebSocketSessionDecorator
でラップすることです。
WebSocketSession
の sendMessage
IOExceptionSE
ConcurrentWebSocketSessionDecorator
protected abstract void sendInternal(TextMessage textMessage) 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 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