Package com.qtsurfer.api.sdk
Class LiveConnection
java.lang.Object
com.qtsurfer.api.sdk.LiveConnection
- All Implemented Interfaces:
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 Summary
Modifier and TypeMethodDescriptionvoidclose()Stop reconnecting and release the underlying WebSocket client and threads.static CompletableFuture<LiveConnection>connect(String runId, LiveConnectionOptions options, Supplier<String> tokenProvider) Mint a token, connect, and resolve after the signal channel is subscribed.voidStop the subscription and reconnect loop; equivalent toclose().history()Read up to 300 recent sandbox signals from the subscribed channel, oldest first.history(int limit, LiveSignalHistory.Position since) Read the channel's recent sandbox signals after an optional earlier position.CompletableFuture<com.qtsurfer.api.client.model.LiveParamsUpdateResult>updateParams(com.qtsurfer.api.client.model.UpdateLiveParamsRequest request) Send the same owner-only parameter update as RESTPUT /live/{runId}/params.CompletableFuture<com.qtsurfer.api.client.model.LiveParamsUpdateResult>Update parameters using the SDK's fluent request builder.CompletableFuture<com.qtsurfer.api.client.model.LiveParamsUpdateResult>updateParams(Map<String, ?> params) Update parameters using strategy property names and values.
-
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 RESTPUT /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
Read the channel's recent sandbox signals after an optional earlier position.A
nullposition 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 withoutsinceor use the REST retained-signals endpoint. -
disconnect
public void disconnect()Stop the subscription and reconnect loop; equivalent toclose(). -
close
public void close()Stop reconnecting and release the underlying WebSocket client and threads.- Specified by:
closein interfaceAutoCloseable
-