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.

  • Method Details

    • onOpen

      void onOpen(WebsocketSession session)
      Called after the opening handshake has completed and the session metadata is available.
      Parameters:
      session - the newly opened session
    • onMessage

      void onMessage(byte[] bytes, WebsocketSession session)
      Called when a complete binary message has been received.
      Parameters:
      bytes - the full binary message payload
      session - 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 payload
      session - the session that received the message
      receiveTiming - timing captured by the underlying websocket listener
    • captureReceiveTiming

      default boolean captureReceiveTiming()
      Returns whether this endpoint wants low-level receive timing for binary messages.
      Returns:
      true when the websocket session should capture receive and dispatch timestamps
    • onPong

      void onPong(ByteBuffer data, WebsocketSession session)
      Called when a pong frame has been received.
      Parameters:
      data - the pong application data
      session - the session that received the pong
    • onClose

      void onClose(WebsocketSession session, WebsocketCloseReason closeReason)
      Called once when a session closes or is aborted.
      Parameters:
      session - the closed session
      closeReason - the close status and optional reason
    • onError

      void onError(WebsocketSession session, Throwable error)
      Called when the underlying WebSocket implementation reports an error.
      Parameters:
      session - the session that failed
      error - the reported error