Class RainPointSessionRecovery
- Namespace
- RainPointClient
- Assembly
- RainPointClient.dll
Opt-in session renewal and bounded credential recovery, independent of device commands.
public sealed class RainPointSessionRecovery
- Inheritance
-
RainPointSessionRecovery
- Inherited Members
Remarks
Sign in before starting. Stop and await this worker before changing accounts, logging out or disposing the client. Events run on a background thread. A credential provider must return the same account and honor cancellation. A worker waits two minutes before requesting credentials, then permits at most one automatic password login; failure or another invalidation requires explicit sign-in. No failed read, setting write or watering command is ever replayed. The caller owns secure credential storage.
Constructors
RainPointSessionRecovery(RainPointCloudClient, Func<CancellationToken, Task<RainPointCredentials?>>?)
Creates an unstarted recovery worker with an optional caller-controlled credential provider.
public RainPointSessionRecovery(RainPointCloudClient client, Func<CancellationToken, Task<RainPointCredentials?>>? credentialProvider = null)
Parameters
clientRainPointCloudClientThe caller-owned cloud client; this helper does not dispose it.
credentialProviderFunc<CancellationToken, Task<RainPointCredentials>>An optional cancellable provider for the same account's credentials; null permits refresh-token recovery only.
Properties
State
Gets the worker's current session-health and recovery state.
public RainPointSessionState State { get; }
Property Value
Methods
RunAsync(CancellationToken)
Starts the single-use worker after explicit sign-in and runs until cancellation or stop.
public Task RunAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation for this operation; cancelling after submission does not prove that a cloud write was undone.
Returns
- Task
A task representing the operation lifetime.
Exceptions
- InvalidOperationException
A session recovery worker can run only once. Sign in before starting session recovery. This client already has a session recovery worker.
StopAsync()
Cancels recovery and waits for the worker to finish before the client is reused or disposed.
public Task StopAsync()
Returns
- Task
A task representing the operation lifetime.
Events
StateChanged
Occurs on a background thread when session-health or recovery state changes.
public event EventHandler<RainPointSessionStateChangedEventArgs>? StateChanged