Skip to main content

What is Synheart Session?

Synheart Session is a real-time biometric session SDK that captures heart rate data from wearable sensors, computes session metrics on-device, and optionally fuses timing-based behavioral signals alongside HR data. It supports timed sessions with configurable modes, streaming session frames at regular intervals, and delivers a final session summary when complete. The watch runs SessionEngine locally, computes session frames with flat HR/HRV metrics (and optional motion metrics), and streams them back to the phone in real time via WatchConnectivity (iOS) or Wearable Data Layer (Android). When no watch is available, the SDK falls back to a local engine transparently. The SDK optionally integrates with Synheart Flux for normalized HSI 1.0 scoring when the Flux binary is bundled.

Key Features

Session Lifecycle

  • Configurable sessions: Set mode (focus, breathing), duration, and compute profile
  • Streaming session frames: Receive periodic session frames with flat metrics during the session
  • Session summary: Get a final computation covering the full session duration
  • Typed event stream: SessionStarted, SessionFrame, BiosignalFrame, SessionSummary, SessionError
  • Optional raw biosignal streaming: Opt-in includeRawSamples for live HR trace, RR intervals, and accelerometer data
  • Motion metrics on watch: Watch companion apps stream per-frame motion_rms_g and motion_sample_count alongside HR metrics (iOS also includes active_energy_kcal)

Pluggable Providers

  • BiosignalProvider: Pluggable HR source — mock (sinusoidal), BLE HRM (via synheart-wear), HealthKit, Health Connect
  • BehaviorProvider: Optional pull-based behavioral signal source — mock (stable mid-range values), synheart-behavior SDK (typing, scrolling, taps, app switches, idle gaps, stability/fragmentation indices)
  • Backward compatible: All providers are optional with sensible defaults — existing code works unchanged

Phone-Watch Streaming

  • WatchConnectivity relay: Phone sends session commands to the watch via WCSession
  • Watch-side engine: SessionEngine runs on watchOS with direct sensor access
  • Real-time streaming: Session frames stream from watch to phone as they are computed
  • Transparent fallback: If the watch is not reachable, the SDK falls back to a local engine automatically

Cross-Platform

  • Flutter/Dart: Cross-platform mobile SDK with mock and native modes
  • Swift: Native iOS and watchOS SDK with SessionEngine and pluggable providers
  • Kotlin: Native Android SDK with SessionEngine and reflection-based provider wrappers
  • Mock mode: Built-in mock engine for development and testing without hardware

Architecture

Flutter App (Dart)
    | startSession(config)
    v
SynheartSessionPlugin (iOS native)
    |
    |-- Watch reachable? --> WatchSessionRelay
    |                            | WCSession.sendMessage
    |                            v
    |                        PhoneSessionRelay (watchOS)
    |                            | SessionEngine.start
    |                            v
    |                        Session frames stream back via WCSession
    |
    |-- Watch not reachable? --> Local SessionEngine (fallback)
    |
    v
EventChannel --> Flutter Stream<SessionEvent>
    |
    v
SessionStarted -> SessionFrame* (+ BiosignalFrame*) -> SessionSummary

Event Flow

  1. You call startSession(config) which returns a Stream<SessionEvent>
  2. The stream emits SessionStarted when the engine begins
  3. SessionFrame events arrive at the configured emitIntervalSec
  4. If includeRawSamples: true, BiosignalFrame events also arrive at rawEmitIntervalSec (defaults to emitIntervalSec)
  5. When the session ends (duration elapsed or you call stopSession), a SessionSummary is emitted
  6. The stream closes automatically after summary or error

Session Modes

ModeDescription
focusSteady-state measurement for attention and cognitive sessions
breathingGuided breathing sessions with HRV-focused computation

Compute Profile

The ComputeProfile controls how often session frames are emitted and the window size for computation:
ParameterDefaultDescription
windowSec60Size of the sliding window (seconds) for HR/HRV computation
emitIntervalSec5How often to emit a session frame (seconds)
rawEmitIntervalSecnullHow often to emit raw biosignal frames (seconds). Defaults to emitIntervalSec when null

Raw Biosignal Streaming

When includeRawSamples is enabled in SessionConfig, the engine emits BiosignalFrame events alongside session frames. Each BiosignalFrame contains an array of BiosignalSample objects with:
FieldTypeDescription
timestampMsintUnix timestamp in milliseconds
bpmdoubleInstantaneous heart rate in BPM
rrIntervalMsdouble?Inter-beat (RR) interval in milliseconds
accelerometer{x, y, z}?3-axis accelerometer reading
spo2double?SpO2 percentage (0-100) when available
This is useful for live HR trace display, RR interval visualization, and motion artifact detection. Session frames continue to emit normally — raw biosignal data is additive.

Available SDKs

Flutter/Dart SDK

Cross-platform SDK for iOS and Android apps with mock mode for development. Supports optional BehaviorProvider in mock mode; in production, behavioral data flows from the native SessionEngine automatically.

Dart SDK Documentation

Flutter integration guide
Installation:
dependencies:
  synheart_session: ^0.2.0
Version: 0.2.0 Repository: synheart-session-dart

Swift SDK

Native Swift SDK for iOS and watchOS with SessionEngine, pluggable BiosignalProvider and BehaviorProvider.

Swift SDK Documentation

Swift and watchOS integration guide
Installation:
.package(url: "https://github.com/synheart-ai/synheart-session-swift.git", from: "0.2.0")
Version: 0.2.0 Repository: synheart-session-swift

Kotlin SDK

Native Kotlin SDK for Android with SessionEngine, pluggable BiosignalProvider and BehaviorProvider (reflection-based wrappers). Installation:
dependencies {
    implementation 'ai.synheart:session:0.2.0'
}
Version: 0.2.0 Repository: synheart-session-kotlin

Session Frame Structure

Each SessionFrame contains a flat metrics dictionary with HR, HRV, and optional motion metrics. When a BehaviorProvider is configured, an optional behavior map is also included:
{
  "type": "session_frame",
  "session_id": "abc-123",
  "seq": 1,
  "emitted_at_ms": 1700000030000,
  "metrics": {
    "hr_mean_bpm": 72.3,
    "hr_sdnn_ms": 45.12,
    "rmssd_ms": 36.10,
    "sample_count": 60,
    "start_ms": 1700000000000,
    "end_ms": 1700000060000,
    "motion_rms_g": 1.02,
    "motion_sample_count": 125,
    "active_energy_kcal": 12.5
  }
}

Frame Metrics

KeyTypePlatformsDescription
hr_mean_bpmdoubleAllMean heart rate in BPM over the window
hr_sdnn_msdoubleAllStandard deviation of NN intervals (ms)
rmssd_msdoubleAllRoot mean square of successive RR differences (ms)
sample_countintAllNumber of HR samples in the window
start_msintAllWindow start timestamp (ms since epoch)
end_msintAllWindow end timestamp (ms since epoch)
motion_rms_gdoubleWatchRMS acceleration magnitude in g-force (optional)
motion_sample_countintWatchNumber of accelerometer samples in the frame interval (optional)
active_energy_kcaldoublewatchOSCumulative active energy burned in kcal (optional, iOS only)
motion_rms_g and motion_sample_count are present when the wearable has an accelerometer. active_energy_kcal is iOS-only (from HKLiveWorkoutBuilder). All motion/energy keys are optional — absent if the sensor is unavailable.

Next Steps

Dart SDK

Flutter integration guide

Swift SDK

Swift and watchOS guide

Kotlin SDK

Android integration guide

Watch Companion Apps

Community


Author: Israel Goytom Made with care by the Synheart AI Team