Class SocketEndpointHandler.SocketEndpointWrapper
java.lang.Object
io.fluxzero.sdk.web.SocketEndpointHandler.SocketEndpointWrapper
- Enclosing class:
SocketEndpointHandler
A stateful wrapper around a WebSocket endpoint instance, managing per-session behavior and message handling.
This class is created per WebSocket session and holds:
- A lazily instantiated target handler
- Connection health tracking (ping/pong logic)
- Automatic session cleanup via
Registrationhooks - Delegation to matching methods for open, message, pong, and close events
When the first @HandleSocketOpen or @HandleSocketMessage message arrives for a session,
the target handler is initialized and stored. Subsequent WebSocket lifecycle messages (e.g. @HandleSocketPong,
@HandleSocketClose) are routed to the correct methods on the same instance.
Ping scheduling and timeout behavior is based on the SocketEndpoint.aliveCheck() configuration.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidabort(int closeCode) protected booleanisOpen()protected voidonClose(DeserializingMessage message) protected ObjectonOpenOrMessage(SocketSession session, DeserializingMessage message) protected voidonPong(DeserializingMessage message) protected voidsendPing(Duration pingTimeout, TaskScheduler taskScheduler) protected voidprotected Objectunwrap()
-
Constructor Details
-
SocketEndpointWrapper
public SocketEndpointWrapper()
-
-
Method Details
-
onOpenOrMessage
@HandleSocketOpen @HandleSocketMessage protected Object onOpenOrMessage(SocketSession session, DeserializingMessage message) -
onPong
-
trySchedulePing
protected void trySchedulePing() -
sendPing
-
onClose
-
abort
protected void abort(int closeCode) -
isOpen
protected boolean isOpen() -
unwrap
-