Package io.fluxcapacitor.javaclient.web
Class SocketEndpointHandler
java.lang.Object
io.fluxcapacitor.javaclient.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 Flux dispatcher infrastructure.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A stateful wrapper around a WebSocket endpoint instance, managing per-session behavior and message handling.Nested classes/interfaces inherited from interface io.fluxcapacitor.common.handling.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 aHandlerInvoker
capable of processing the given message, if available.toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.fluxcapacitor.common.handling.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:Handler
Returns aHandlerInvoker
capable of processing the given message, if available.- Specified by:
getInvoker
in interfaceHandler<DeserializingMessage>
- Parameters:
message
- the message to be handled- Returns:
- an optional
HandlerInvoker
if this handler can handle the message; otherwiseOptional.empty()
-
toString
-