Interface ServerWebsocketSession
public interface ServerWebsocketSession
Minimal server-side WebSocket session contract used by the in-memory Fluxzero test server.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault upper bound for one physical WebSocket binary frame when a message is sent as fragments. -
Method Summary
Modifier and TypeMethodDescriptionvoidabort(WebsocketCloseReason closeReason) Terminates the connection without waiting for a close handshake.voidclose()Closes the session normally.voidclose(WebsocketCloseReason closeReason) Closes the session with the provided WebSocket close code and reason.Returns the headers from the WebSocket upgrade request.Returns the decoded query parameters from the WebSocket upgrade request.Returns the URI that was used for the WebSocket upgrade request.Returns per-session attributes derived during the WebSocket handshake.booleanisOpen()Returns whether the underlying transport still accepts frames.voidsendBinary(ByteBuffer data) Sends a complete binary message.default CompletableFuture<Void> sendBinaryAsync(ByteBuffer data) Sends a complete binary message asynchronously.default CompletableFuture<Void> sendBinaryAsync(ByteBuffer data, int maxFragmentBytes) Sends one complete binary WebSocket message asynchronously, allowing implementations to split the message into WebSocket continuation frames.voidsendPing(ByteBuffer applicationData) Sends a ping frame with optional application data.
-
Field Details
-
DEFAULT_MAX_BINARY_FRAGMENT_BYTES
static final int DEFAULT_MAX_BINARY_FRAGMENT_BYTESDefault upper bound for one physical WebSocket binary frame when a message is sent as fragments.- See Also:
-
-
Method Details
-
getRequestURI
URI getRequestURI()Returns the URI that was used for the WebSocket upgrade request. -
getRequestParameterMap
-
getRequestHeaders
-
getUserProperties
-
isOpen
boolean isOpen()Returns whether the underlying transport still accepts frames. -
sendBinary
Sends a complete binary message.- Throws:
IOException
-
sendBinaryAsync
Sends a complete binary message asynchronously.The default delegates to the blocking send so existing lightweight sessions remain compatible.
-
sendBinaryAsync
Sends one complete binary WebSocket message asynchronously, allowing implementations to split the message into WebSocket continuation frames.The default delegates to
sendBinaryAsync(ByteBuffer)so existing simple implementations keep working. Implementations that support native WebSocket fragmentation should preserve message ordering and complete the returned future only after the final fragment has been accepted by the transport. -
sendPing
Sends a ping frame with optional application data.- Throws:
IOException
-
close
-
close
Closes the session with the provided WebSocket close code and reason.- Throws:
IOException
-
abort
Terminates the connection without waiting for a close handshake.
-