Class SocketRequest

java.lang.Object
io.fluxcapacitor.javaclient.web.SocketRequest

public class SocketRequest extends Object
A wrapper representing a serialized request sent over a WebSocket session.

Each SocketRequest includes a unique requestId used to track and match responses, and a JsonNode representation of the actual request payload.

Requests are typically created using the static valueOf(Object) method, which serialize the original request object to JSON. The requestId can be autogenerated or provided explicitly.

Note: In most cases, SocketRequests and SocketResponses are created and handled automatically by the SocketSession. Developers working within a Flux Capacitor system typically do not need to construct them manually. However, understanding their format becomes important when integrating with non-Flux systems—such as a browser-based UI—over WebSocket. In such scenarios, this class defines the structure of a request expected by a Flux client.

See Also:
  • Field Details

    • counter

      public static final AtomicLong counter
      Counter used to generate unique request IDs for new socket requests.
  • Constructor Details

    • SocketRequest

      public SocketRequest()
  • Method Details

    • valueOf

      public static SocketRequest valueOf(Object request)
      Creates a new SocketRequest with an auto-incremented ID and the given request object.
      Parameters:
      request - the request object to be sent over the WebSocket session
      Returns:
      a new SocketRequest instance with a unique ID