Interface WebsocketSession
public interface WebsocketSession
Minimal websocket session contract needed by the Fluxzero runtime clients.
The contract is binary-frame oriented because Fluxzero runtime traffic is serialized and compressed before it is sent. Implementations should make close and abort callbacks idempotent so higher-level retry logic can safely react to transport races.
-
Method Summary
Modifier and TypeMethodDescriptionvoidabort(WebsocketCloseReason closeReason) Immediately aborts the underlying transport and reports the given close reason to the endpoint.voidclose()Closes the session with a normal close reason.voidclose(WebsocketCloseReason closeReason) Closes the session with a specific close reason.Returns the response headers from the successful opening handshake.Returns a snapshot of currently open sessions owned by the same connector.Returns the URI used to open this session.Returns mutable metadata associated with this session.booleanisOpen()Returns whether the session is still open for application traffic.voidsendBinary(ByteBuffer data) Sends one complete binary WebSocket message.voidsendPing(ByteBuffer applicationData) Sends a ping frame.
-
Method Details
-
getRequestURI
URI getRequestURI()Returns the URI used to open this session. -
getUserProperties
-
getHandshakeResponseHeaders
-
getOpenSessions
Set<WebsocketSession> getOpenSessions()Returns a snapshot of currently open sessions owned by the same connector. -
isOpen
boolean isOpen()Returns whether the session is still open for application traffic. -
sendBinary
Sends one complete binary WebSocket message.- Parameters:
data- bytes from the buffer's current position to its limit- Throws:
IOException- when the frame cannot be sent
-
sendPing
Sends a ping frame.- Parameters:
applicationData- ping payload from the buffer's current position to its limit- Throws:
IOException- when the frame cannot be sent
-
close
Closes the session with a normal close reason.- Throws:
IOException- when the close frame cannot be sent
-
close
Closes the session with a specific close reason.- Parameters:
closeReason- close status and reason to send- Throws:
IOException- when the close frame cannot be sent
-
abort
Immediately aborts the underlying transport and reports the given close reason to the endpoint.- Parameters:
closeReason- synthetic close status and reason to report
-