Class ClientStateLedger
Maintains a ledger of client state transitions with timestamps. Tracks and records the history of state changes for a specific client over time.
Inheritance
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class ClientStateLedger : object
Constructors
ClientStateLedger(String, String)
Initializes a new instance of the ClientStateLedger class. Automatically records an initial "New" state.
Declaration
public ClientStateLedger(string clientId, string externalId)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientId | The unique identifier for the client to track. |
System.String | externalId | The external identifier for the client. Can be null. |
Methods
RecordClientState(ClientState)
Records a new client state transition with the current timestamp. Adds a new record to the state history with both UTC time and millisecond precision timestamp.
Declaration
public void RecordClientState(ClientState state)
Parameters
Type | Name | Description |
---|---|---|
ClientState | state | The new client state to record. |
ToString()
Provides a JSON string representation of all recorded state transitions. Includes client identification, state transition history with timestamps and elapsed times, and diagnostic information if the client never reached the registered state.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | A JSON formatted string containing the complete state transition history and diagnostics. Returns "{}" if no states have been recorded. |