FMLiveSwitchClientStateLedger Class Reference

Maintains a ledger of client state transitions with timestamps. More...

Instance Methods

(NSString *) - description
 Provides a JSON string representation of all recorded state transitions. More...
 
(instancetype) - initWithClientId:externalId:
 Initializes a new instance of the ClientStateLedger class. More...
 
(void) - recordClientState:
 Records a new client state transition with the current timestamp. More...
 

Class Methods

(FMLiveSwitchClientStateLedger *) + clientStateLedgerWithClientId:externalId:
 Initializes a new instance of the ClientStateLedger class. More...
 

Detailed Description

Maintains a ledger of client state transitions with timestamps.

Tracks and records the history of state changes for a specific client over time.

Method Documentation

◆ clientStateLedgerWithClientId:externalId:

+ (FMLiveSwitchClientStateLedger*) clientStateLedgerWithClientId: (NSString *)  clientId
externalId: (NSString *)  externalId 

Initializes a new instance of the ClientStateLedger class.

Automatically records an initial "New" state.

Parameters
clientIdThe unique identifier for the client to track.
externalIdThe external identifier for the client. Can be null.

◆ description

- (NSString*) description

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.

Returns
A JSON formatted string containing the complete state transition history and diagnostics. Returns "{}" if no states have been recorded.

◆ initWithClientId:externalId:

- (instancetype) initWithClientId: (NSString *)  clientId
externalId: (NSString *)  externalId 

Initializes a new instance of the ClientStateLedger class.

Automatically records an initial "New" state.

Parameters
clientIdThe unique identifier for the client to track.
externalIdThe external identifier for the client. Can be null.

◆ recordClientState:

- (void) recordClientState: (FMLiveSwitchClientState)  state

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.

Parameters
stateThe new client state to record.