Class LiveConnection

java.lang.Object
com.qtsurfer.api.sdk.LiveConnection
All Implemented Interfaces:
AutoCloseable

public final class LiveConnection extends Object implements AutoCloseable
A managed WebSocket subscription to one live run's signal channel.

The connection owns its Centrifugo client and must be closed when no longer needed. Reconnects and token refresh are managed automatically. A reconnect may miss signals; use history(int, LiveSignalHistory.Position) for the channel's recent sandbox signals, or getLiveSignals for durable retained history.

  • Method Details

    • connect

      public static CompletableFuture<LiveConnection> connect(String runId, LiveConnectionOptions options, Supplier<String> tokenProvider)
      Mint a token, connect, and resolve after the signal channel is subscribed.
    • updateParams

      public CompletableFuture<com.qtsurfer.api.client.model.LiveParamsUpdateResult> updateParams(com.qtsurfer.api.client.model.UpdateLiveParamsRequest request)
      Send the same owner-only parameter update as REST PUT /live/{runId}/params.
    • updateParams

      public CompletableFuture<com.qtsurfer.api.client.model.LiveParamsUpdateResult> updateParams(UpdateLiveParamsRequestBuilder request)
      Update parameters using the SDK's fluent request builder.
    • updateParams

      public CompletableFuture<com.qtsurfer.api.client.model.LiveParamsUpdateResult> updateParams(Map<String,?> params)
      Update parameters using strategy property names and values.
    • history

      Read up to 300 recent sandbox signals from the subscribed channel, oldest first.
    • history

      public CompletableFuture<LiveSignalHistory> history(int limit, LiveSignalHistory.Position since)
      Read the channel's recent sandbox signals after an optional earlier position.

      A null position starts at the oldest held signal. A limit of zero reads only the current position. Error 112 means the position's epoch is no longer available; retry without since or use the REST retained-signals endpoint.

    • disconnect

      public void disconnect()
      Stop the subscription and reconnect loop; equivalent to close().
    • close

      public void close()
      Stop reconnecting and release the underlying WebSocket client and threads.
      Specified by:
      close in interface AutoCloseable