Class WebSocketClient

All Implemented Interfaces:
Namespaced<Client>, Client

public class WebSocketClient extends AbstractClient
A Client implementation that connects to the Fluxzero Runtime using WebSocket connections.

This client enables full integration with the Fluxzero Runtime by delegating all gateway, tracking, and subsystem communication to remote endpoints defined by the WebSocketClient.ClientConfig. It is typically used in production and testing environments where communication with the Fluxzero Runtime is required.

Usage

WebSocketClient client = WebSocketClient.newInstance(
    WebSocketClient.ClientConfig.builder()
        .runtimeBaseUrl("wss://my.fluxzero.host")
        .name("my-service")
        .build());
Fluxzero fluxzero = Fluxzero.builder().build(client);
See Also:
  • Constructor Details

  • Method Details

    • newInstance

      public static WebSocketClient newInstance(WebSocketClient.ClientConfig clientConfig)
      Creates a WebSocket client using the supplied connection configuration.
    • getNamespaces

      public CompletableFuture<List<String>> getNamespaces()
      Description copied from interface: Client
      Returns a sorted, duplicate-free snapshot of namespaces in this client's storage environment. The Runtime includes persisted namespaces without active clients. Local clients include namespaces created within the same root client; independent local clients remain isolated. Discovery does not create namespaces. This Runtime-wide operation requires a server and deployment route supporting namespace discovery. Custom clients that do not implement discovery fail explicitly instead of returning a partial list.
    • shutDown

      public void shutDown()
      Description copied from interface: Client
      Shuts down this client instance, releasing any underlying resources.

      This includes closing websocket sessions, stopping tracking, and executing registered shutdown hooks.

      Specified by:
      shutDown in interface Client
      Overrides:
      shutDown in class AbstractClient
    • name

      public String name()
      Description copied from interface: Client
      Returns the name of this client as defined in its configuration.
    • id

      public String id()
      Description copied from interface: Client
      Returns the unique identifier of this client instance. This id may be randomly generated.
    • applicationId

      public String applicationId()
      Description copied from interface: Client
      Returns the application ID under which this client instance is registered.
    • namespace

      public String namespace()
      Description copied from interface: Client
      Returns the namespace associated with this client instance.
    • createForNamespace

      protected Client createForNamespace(String namespace)
      Specified by:
      createForNamespace in class AbstractNamespaced<Client>
    • createGatewayClient

      protected GatewayClient createGatewayClient(io.fluxzero.common.MessageType messageType, String topic)
      Description copied from class: AbstractClient
      Subclasses must implement this method to return a GatewayClient for the given message type and topic.
      Specified by:
      createGatewayClient in class AbstractClient
    • createTrackingClient

      protected TrackingClient createTrackingClient(io.fluxzero.common.MessageType messageType, String topic)
      Description copied from class: AbstractClient
      Subclasses must implement this method to return a TrackingClient for the given message type and topic.
      Specified by:
      createTrackingClient in class AbstractClient
    • createEventStoreClient

      protected EventStoreClient createEventStoreClient()
      Description copied from class: AbstractClient
      Subclasses must implement this method to return a EventStoreClient.
      Specified by:
      createEventStoreClient in class AbstractClient
    • createSchedulingClient

      protected SchedulingClient createSchedulingClient()
      Description copied from class: AbstractClient
      Subclasses must implement this method to return a SchedulingClient.
      Specified by:
      createSchedulingClient in class AbstractClient
    • createKeyValueClient

      protected KeyValueClient createKeyValueClient()
      Description copied from class: AbstractClient
      Subclasses must implement this method to return a KeyValueClient.
      Specified by:
      createKeyValueClient in class AbstractClient
    • createSearchClient

      protected SearchClient createSearchClient()
      Description copied from class: AbstractClient
      Subclasses must implement this method to return a SearchClient.
      Specified by:
      createSearchClient in class AbstractClient