What is Synheart Session?
Synheart Session is an SDK for running timed biometric sessions. A session buffers heart-rate samples from a pluggableBiosignalProvider in a sliding window, emits a SessionFrame with flat metrics at a fixed interval, and delivers a SessionSummary when the session ends. A BehaviorProvider can add timing-based behavioral signals to each frame.
The SDK computes mean heart rate on-device. It does not compute HRV: hr_sdnn_ms, rmssd_ms, and pnn50 come from the host through ingestHsiMetrics() (typically from the Synheart runtime) and are 0.0 until the host supplies them.
For real-time data from a smartwatch, Synheart’s companion watch apps (watchOS and Wear OS) run the session on the watch and stream events to the phone. The phone SDKs relay start/stop commands and receive those events. There is no automatic fallback to a phone-side source: if no watch is reachable, the session gets no heart-rate data. See Lifecycle.
Key Features
Session Lifecycle
- Configurable sessions: Set mode (
focus,breathing,typing), duration, and compute profile - Streaming session frames: Periodic frames with flat metrics during the session
- Session summary: A final frame computed when the session ends
- Typed event stream:
SessionStarted,SessionFrame,BiosignalFrame,SessionSummary,SessionError - Optional raw biosignal streaming: Opt-in
includeRawSamplesfor a live HR trace
Pluggable Providers
- BiosignalProvider: HR source — mock (sinusoidal), BLE HRM and Health Connect (Kotlin, via synheart-wear), HealthKit and BLE HRM (Swift, via synheart-wear), companion watch (Flutter)
- BehaviorProvider: Optional pull-based behavioral source — mock, or synheart-behavior (bundled wrapper in Kotlin and Swift)
- Providers are constructor arguments of
SynheartSessionand are optional; the Kotlin and Swift default biosignal provider is the mock
Phone-Watch Streaming
- Flutter: pass a
WatchBiosignalProviderand the SDK sends start/stop commands to the companion app on Apple Watch (WatchConnectivity) or Wear OS (Wearable Data Layer) - Kotlin:
WatchSessionRelaydrives a session on a Wear OS watch and returns the watch’s events as aFlow<SessionEvent> - Swift: the Swift SDK runs sessions on the device it is linked into (including watchOS); it does not include a phone-side relay
Cross-Platform
- Flutter/Dart:
SynheartSession()(live) andSynheartSession.mock()(simulated) - Kotlin:
SynheartSessionreturning aSharedFlow<SessionEvent> - Swift:
SynheartSessionreturning anAsyncStream<SessionEvent> - Wire format: every SDK serializes events to the same snake_case map (
toJson()/toMap()/toDictionary())
Architecture
Event Flow
- You call
startSession(config), which returns a stream ofSessionEvents SessionStartedis emitted immediatelySessionFrameevents arrive everyemitIntervalSec- If
includeRawSamplesistrue,BiosignalFrameevents also arrive everyrawEmitIntervalSec(defaults toemitIntervalSec) — Kotlin, Swift, and the Flutter mock engine - When the duration elapses or you call
stopSession, aSessionSummaryis emitted - The Flutter stream and the Swift stream finish after the summary. The Kotlin
SharedFlownever completes, so stop collecting onSessionSummaryorSessionErrorEvent
Session Modes
The phone-side engines compute the same metrics in every mode. The mode is carried in the config and forwarded to the watch in the
start_session command.
Compute Profile
TheComputeProfile controls the window size and how often frames are emitted:
Raw Biosignal Streaming
WhenincludeRawSamples is enabled in SessionConfig, the Kotlin and Swift engines and the Flutter mock engine emit BiosignalFrame events alongside session frames. The Flutter live engine does not emit BiosignalFrame.
Kotlin and Swift samples are maps with these keys:
In Dart,
BiosignalFrame.samples is a List<BiosignalSample> with timestampMs, bpm, rrIntervalMs, accelerometer, and spo2. The mock engine fills accelerometer with synthetic values.
Available SDKs
Flutter SDK
Cross-platform SDK for iOS and Android with a mock mode for development.Flutter SDK Documentation
Flutter integration guide
>=3.8.0 <4.0.0, Flutter >=3.22.0
Repository: synheart-session-flutter · runnable example
Swift SDK
Native Swift SDK withSynheartSession and pluggable BiosignalProvider and BehaviorProvider.
Swift SDK Documentation
Swift and watchOS integration guide
Kotlin SDK
Native Kotlin SDK for Android withSynheartSession, pluggable providers (reflection-based wrappers for synheart-wear and synheart-behavior), and WatchSessionRelay for Wear OS.
Kotlin SDK Documentation
Android integration guide
Stability
Synheart Session is pre-1.0. Minor version bumps may include breaking API changes — pin exact versions in production, and read the CHANGELOG before upgrading. Kotlin 0.4.0 and Swift 0.3.0 are minor bumps because the newtyping mode breaks exhaustive when / switch statements over SessionMode.
Session Frame Structure
EachSessionFrame carries a flat metrics map. When a BehaviorProvider is configured and returns a snapshot, a behavior map is included too:
Frame Metrics
Platform differences:
- Flutter also puts
session_id,mode, andseqinsidemetrics. The Flutter live engine emits frames even when the window is empty (sample_count0,hr_mean_bpm0.0). - Flutter mock engine emits synthetic
hr_sdnn_msandrmssd_msderived from its generated data, adds"mock": true, and does not emitpnn50. - Kotlin and Swift skip a frame when the window holds no samples.
Next Steps
Flutter SDK
Flutter integration guide
Swift SDK
Swift and watchOS guide
Kotlin SDK
Android integration guide
Community
- GitHub: github.com/synheart-ai — every Session SDK lives in its per-language repo (
synheart-session-flutter,synheart-session-kotlin,synheart-session-swift). - Issues: file against the relevant per-language repo.