Interface WebsocketEndpoint
- All Known Implementing Classes:
AbstractWebsocketClient, WebSocketEventStoreClient, WebsocketGatewayClient, WebsocketKeyValueClient, WebsocketSchedulingClient, WebSocketSearchClient, WebsocketTrackingClient
public interface WebsocketEndpoint
Callback contract for low-level Fluxzero runtime websocket sessions.
Implementations should return quickly from these callbacks. Higher-level Fluxzero clients dispatch expensive result handling onto worker executors so transport callbacks do not block the underlying WebSocket implementation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordLow-level receive timing captured before dispatching to the Fluxzero endpoint. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanReturns whether this endpoint wants low-level receive timing for binary messages.voidonClose(WebsocketSession session, WebsocketCloseReason closeReason) Called once when a session closes or is aborted.voidonError(WebsocketSession session, Throwable error) Called when the underlying WebSocket implementation reports an error.voidonMessage(byte[] bytes, WebsocketSession session) Called when a complete binary message has been received.default voidonMessage(byte[] bytes, WebsocketSession session, WebsocketEndpoint.ReceiveTiming receiveTiming) Called when a complete binary message has been received, with low-level receive timing when available.voidonOpen(WebsocketSession session) Called after the opening handshake has completed and the session metadata is available.voidonPong(ByteBuffer data, WebsocketSession session) Called when a pong frame has been received.
-
Method Details
-
onOpen
Called after the opening handshake has completed and the session metadata is available.- Parameters:
session- the newly opened session
-
onMessage
Called when a complete binary message has been received.- Parameters:
bytes- the full binary message payloadsession- the session that received the message
-
onMessage
default void onMessage(byte[] bytes, WebsocketSession session, WebsocketEndpoint.ReceiveTiming receiveTiming) Called when a complete binary message has been received, with low-level receive timing when available.- Parameters:
bytes- the full binary message payloadsession- the session that received the messagereceiveTiming- timing captured by the underlying websocket listener
-
captureReceiveTiming
default boolean captureReceiveTiming()Returns whether this endpoint wants low-level receive timing for binary messages.- Returns:
truewhen the websocket session should capture receive and dispatch timestamps
-
onPong
Called when a pong frame has been received.- Parameters:
data- the pong application datasession- the session that received the pong
-
onClose
Called once when a session closes or is aborted.- Parameters:
session- the closed sessioncloseReason- the close status and optional reason
-
onError
Called when the underlying WebSocket implementation reports an error.- Parameters:
session- the session that failederror- the reported error
-