Class SocketEndpointHandler
java.lang.Object
io.fluxzero.sdk.web.SocketEndpointHandler
- All Implemented Interfaces:
Handler<DeserializingMessage>
A specialized
Handler that manages lifecycle events and message dispatching for WebSocket endpoints annotated
with SocketEndpoint.
This handler supports:
- Instantiating and caching per-session WebSocket handler instances
- Delegating to the correct handler method (e.g.,
@HandleSocketOpen,@HandleSocketMessage,@HandleSocketPong,@HandleSocketClose) - Managing handler lifecycle via
SocketEndpointHandler.SocketEndpointWrapper, including automatic cleanup and ping-based connection health checks
When a DeserializingMessage is received, the handler checks whether it represents a WebSocket request.
If so, it resolves or initializes a SocketEndpointHandler.SocketEndpointWrapper associated with the given session ID and delegates
message handling to the appropriate method. For non-WebSocket messages, the handler behaves like a typical
Handler by invoking any matching method on the target class or on cached wrappers.
This class is primarily intended for internal use by the Fluxzero dispatcher infrastructure.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA stateful wrapper around a WebSocket endpoint instance, managing per-session behavior and message handling.Nested classes/interfaces inherited from interface Handler
Handler.DelegatingHandler<M> -
Constructor Summary
ConstructorsConstructorDescriptionSocketEndpointHandler(Class<?> targetClass, HandlerMatcher<Object, DeserializingMessage> targetMatcher, HandlerMatcher<Object, DeserializingMessage> wrapperMatcher, RepositoryProvider repositoryProvider) -
Method Summary
Modifier and TypeMethodDescriptiongetInvoker(DeserializingMessage message) Returns aHandlerInvokercapable of processing the given message, if available.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Handler
getTargetClass, or
-
Constructor Details
-
SocketEndpointHandler
public SocketEndpointHandler(Class<?> targetClass, HandlerMatcher<Object, DeserializingMessage> targetMatcher, HandlerMatcher<Object, DeserializingMessage> wrapperMatcher, RepositoryProvider repositoryProvider)
-
-
Method Details
-
getInvoker
Description copied from interface:HandlerReturns aHandlerInvokercapable of processing the given message, if available.- Specified by:
getInvokerin interfaceHandler<DeserializingMessage>- Parameters:
message- the message to be handled- Returns:
- an optional
HandlerInvokerif this handler can handle the message; otherwiseOptional.empty()
-
toString
-