Class ProxyWebsocketEndpoint

java.lang.Object
io.fluxzero.proxy.ProxyWebsocketEndpoint

public class ProxyWebsocketEndpoint extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static final record 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ProxyWebsocketEndpoint(io.fluxzero.sdk.configuration.client.Client client, io.fluxzero.sdk.publishing.RequestHandler requestHandler)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
     
    getContext(io.fluxzero.proxy.ProxyWebsocketSession session)
     
    protected void
    handleDisconnects(List<io.fluxzero.common.api.SerializedMessage> resultMessages)
     
    protected void
    handleResultMessages(List<io.fluxzero.common.api.SerializedMessage> resultMessages)
     
    void
    onBinary(io.fluxzero.proxy.ProxyWebsocketSession session, byte[] message)
    Forwards a binary frame as a socket message request.
    void
    onClose(io.fluxzero.proxy.ProxyWebsocketSession session, io.fluxzero.sdk.common.websocket.WebsocketCloseReason closeReason)
    Removes session bookkeeping and keep-alive scheduling, sends its close notification, and waits up to the configured notification timeout.
    void
    onError(io.fluxzero.proxy.ProxyWebsocketSession session, Throwable error)
    Logs a socket transport error, distinguishing already closing channels and idle timeouts from unexpected failures.
    void
    onOpen(io.fluxzero.proxy.ProxyWebsocketSession session)
    Registers an opened socket, forwards its open notification, and schedules keep-alive checks.
    void
    onPong(io.fluxzero.proxy.ProxyWebsocketSession session, ByteBuffer message)
    Consumes matching internal keep-alive pongs and forwards other pong payloads to application handlers.
    void
    onText(io.fluxzero.proxy.ProxyWebsocketSession session, String message)
    Encodes a text frame as UTF-8 and forwards it as a socket message request.
    protected CompletableFuture<?>
    sendCloseRequest(io.fluxzero.proxy.ProxyWebsocketSession session, io.fluxzero.sdk.common.websocket.WebsocketCloseReason closeReason)
     
    protected CompletableFuture<?>
    sendRequest(io.fluxzero.proxy.ProxyWebsocketSession session, String method, byte[] payload)
     
    void
    Shuts down the endpoint with the default close-notification timeout and the standard client and request-handler cleanup policy.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProxyWebsocketEndpoint

      public ProxyWebsocketEndpoint(io.fluxzero.sdk.configuration.client.Client client, io.fluxzero.sdk.publishing.RequestHandler requestHandler)
  • Method Details

    • onOpen

      public void onOpen(io.fluxzero.proxy.ProxyWebsocketSession session)
      Registers an opened socket, forwards its open notification, and schedules keep-alive checks.
    • onBinary

      public void onBinary(io.fluxzero.proxy.ProxyWebsocketSession session, byte[] message)
      Forwards a binary frame as a socket message request.
    • onText

      public void onText(io.fluxzero.proxy.ProxyWebsocketSession session, String message)
      Encodes a text frame as UTF-8 and forwards it as a socket message request.
    • onPong

      public void onPong(io.fluxzero.proxy.ProxyWebsocketSession session, ByteBuffer message)
      Consumes matching internal keep-alive pongs and forwards other pong payloads to application handlers.
    • onClose

      public void onClose(io.fluxzero.proxy.ProxyWebsocketSession session, io.fluxzero.sdk.common.websocket.WebsocketCloseReason closeReason)
      Removes session bookkeeping and keep-alive scheduling, sends its close notification, and waits up to the configured notification timeout. Notification failures propagate and are recorded for close completion.
    • onError

      public void onError(io.fluxzero.proxy.ProxyWebsocketSession session, Throwable error)
      Logs a socket transport error, distinguishing already closing channels and idle timeouts from unexpected failures.
    • sendRequest

      protected CompletableFuture<?> sendRequest(io.fluxzero.proxy.ProxyWebsocketSession session, String method, byte[] payload)
    • sendCloseRequest

      protected CompletableFuture<?> sendCloseRequest(io.fluxzero.proxy.ProxyWebsocketSession session, io.fluxzero.sdk.common.websocket.WebsocketCloseReason closeReason)
    • handleResultMessages

      protected void handleResultMessages(List<io.fluxzero.common.api.SerializedMessage> resultMessages)
    • handleDisconnects

      protected void handleDisconnects(List<io.fluxzero.common.api.SerializedMessage> resultMessages)
    • getContext

      protected ProxyWebsocketEndpoint.SessionContext getContext(io.fluxzero.proxy.ProxyWebsocketSession session)
    • ensureStarted

      protected void ensureStarted()
    • shutDown

      public void shutDown()
      Shuts down the endpoint with the default close-notification timeout and the standard client and request-handler cleanup policy.