Goal
Build a background heartbeat scheduler with an internal state machine (ACTIVE, GRACE, EXPIRED, REVOKED) and callback hooks for state changes. The SDK manages the polling lifecycle; the host app registers callbacks.
Requirements
Functional
Technical
Acceptance Criteria
Dependencies
Goal
Build a background heartbeat scheduler with an internal state machine (
ACTIVE,GRACE,EXPIRED,REVOKED) and callback hooks for state changes. The SDK manages the polling lifecycle; the host app registers callbacks.Requirements
Functional
client.start_heartbeat(session_token, interval_seconds=300)→ spawns background loop.client.stop_heartbeat()→ gracefully stops the loop.ACTIVE→GRACE→EXPIRED;REVOKEDis terminal.on_status_change(old_state, new_state, metadata)callback fired on every state transition.on_error(exception)callback fired on unrecoverable heartbeat failure.on_error.Technical
threading.Threadfor sync;asynciotask for async.Acceptance Criteria
start_heartbeat()spawns background loop.on_status_changecallback.stop_heartbeat()cleanly terminates the loop.on_error.Dependencies