Class WebsocketResponseInterceptor
java.lang.Object
io.fluxzero.sdk.web.WebsocketResponseInterceptor
- All Implemented Interfaces:
DispatchInterceptor
A
DispatchInterceptor that modifies outgoing WebResponse messages in response to WebSocket-based
WebRequests.
This interceptor ensures that appropriate metadata is included in the corresponding WebResponse. It supports
both the WebSocket handshake phase and subsequent message exchanges over an established WebSocket session.
Specifically:
- If the incoming message is a
WS_HANDSHAKE, it adds theclientIdandtrackerIdto the response metadata to identify the connection. - If the session is already open, it includes the
sessionIdand, if absent, sets afunctionfield to eithermessageorack, depending on whether the outgoing message has a payload.
This ensures that the Fluxzero WebSocket infrastructure can properly route and interpret messages sent back to the client.
-
Field Summary
Fields inherited from interface DispatchInterceptor
noOp -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioninterceptDispatch(Message message, MessageType messageType, String topic) Intercepts and conditionally modifies an outgoing message in the context of a WebSocket request.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DispatchInterceptor
andThen, modifySerializedMessage, monitorDispatch
-
Constructor Details
-
WebsocketResponseInterceptor
public WebsocketResponseInterceptor()
-
-
Method Details
-
interceptDispatch
Intercepts and conditionally modifies an outgoing message in the context of a WebSocket request.- Specified by:
interceptDispatchin interfaceDispatchInterceptor- Parameters:
message- the original message to be dispatchedmessageType- the type of the message (e.g., WEBRESPONSE)topic- the topic to which the message is being published- Returns:
- the possibly modified message
-