longPolling
Gets or modifies long polling config.
When set to null
, the internal long polling task will be terminated; when modified to a non-null value, the internal long polling task will be enabled or reconfigured.
If isStarted == false
, the modified value will be retained, but the long-polling task is not started.
If isActive == false
, the change is invalid.
The first long-polling task appears either when start is used (the initial longPolling is not null) or after start (the initial longPolling is null).
Internally a HttpClient is configured based on the apiClient's engine and LongPolling.timeout.
Since creating an HttpClient is not cheap, do not change the value of longPolling too often.
Modifications and reads are thread-safe and are implemented internally on top of StateFlow.
However, the changes do not take effect in real time. If you make multiple changes before the last modified task completes, only the most recent value will be detected afterward.