Integration guide for the rPPG-based real-time physiological monitoring service
Call the official cloud API directly; no deployment required.
wss://wuancheng.com:16443/ws/healthAuthorization: Bearer <API Key>Enterprise License pricing is based on authorized terminals/instances within the contracted scope, separate from self-service Cloud API credits per connection. A 100,000 completed scans package can also be negotiated separately; the contract must define completed scans, failed/retried scans, validity and pricing. One connection does not equal one measurement. Contact wuac@yanshutech.com.
Run inside your own intranet server or Docker container.
ws://127.0.0.1:9100 (server host; enable listener/port mapping for remote)Authorization: Bearer <business-token>| Scenario | Credential | Transport | Source / Notes |
|---|---|---|---|
| Cloud | API Key | Authorization: Bearer | Console > API Access Key |
| Self-hosted / local | business-token | Authorization: Bearer | Host /var/lib/emotion_hr/installations/emotion_hr/security/business-token; Docker /license-state/business-token (path depends on deployment) |
| Self-hosted short-lived (optional) | ehr1 (1–300 s) | Authorization: Bearer | Gateway issues it from the business-token; renew after expiry; never distribute the long-lived token |
| Share link (web) | guest_share JWT | URL query ?token= | Generated by “Live monitoring share” in the console as guest_monitor.html?token=...; 1 hour, single use, charged to the sharer; cloud guest only, not accepted by self-hosted 9100 |
?token= is a compatibility fallback for browsers/share links; setting EMOTION_REQUIRE_AUTH_HEADER=1 disables it (some hardened deployments enable it; it depends on the startup configuration).Origin: https://health.yanshutech.com; otherwise the gateway returns 403.ws_config.json as auth_token; re-run it if the field is missing or rotated.The client (browser / Python / Android) captures camera frames and sends frame data to the server over WebSocket as binary messages.
| Byte offset | Data type | Endianness | Description |
|---|---|---|---|
| Byte 0 | Uint8 | - | Type flag (fixed to 0, indicating a video frame) |
| Byte 1-8 | Float64 | Little Endian | Timestamp (in seconds, double precision) |
| Byte 9... | Bytes | - | JPEG image data (complete file stream) |
Python (OpenCV + struct)
import struct
import time
import cv2
# 1. Compress the frame
_, jpeg = cv2.imencode('.jpg', frame, [int(cv2.IMWRITE_JPEG_QUALITY), 90])
# 2. Build the header: Type(0) + Timestamp(double)
# < means little-endian, B=uchar, d=double
header = struct.pack('<Bd', 0, time.time())
# 3. Send
ws.send(header + jpeg.tobytes(), opcode=2)
JavaScript (Browser)
// Assume jpegBuffer is an image ArrayBuffer
const timestamp = Date.now() / 1000;
const totalLen = 1 + 8 + jpegBuffer.byteLength;
const buffer = new ArrayBuffer(totalLen);
const view = new DataView(buffer);
// 1. Write type and timestamp (true = little-endian)
view.setUint8(0, 0);
view.setFloat64(1, timestamp, true);
// 2. Write image data
new Uint8Array(buffer, 9).set(new Uint8Array(jpegBuffer));
ws.send(buffer);
The server pushes analysis results over WebSocket every 30 frames (about 1 second) as JSON. hrv is null while warming up. The structure is as follows:
| JSON path | Unit | Description |
|---|---|---|
spo2 | % | Blood oxygen saturation (estimate). If it stays below 95%, re-measure with a medical device and consult a doctor. |
hrv.meanHr | bpm | Mean heart rate. |
hrv.sdnn | ms | SDNN (Standard Deviation of NN intervals). |
hrv.rmssd | ms | RMSSD. Mainly reflects parasympathetic activity. |
hrv.SBP / hrv.DBP | mmHg | Estimated systolic / diastolic blood pressure (wellness estimate, not a cuff replacement). |
hrv.Breathing_RATE | rpm | Respiratory rate. |
| JSON path | Description |
|---|---|
emotion_short_res | Emotion distribution: an object mapping Chinese labels (e.g. 中性, 快乐, 伤心) to probabilities; only entries > 0.05 are kept. May be null while warming up. |
hrv.mood_score.stress_score | Stress index (0-100), a trend score. |
hrv.mood_score.attention_score | Attention trend score. |
Right-click and choose "Save as" to download; documentation opens in the browser.
| File | Description | Action |
|---|---|---|
| integration.html | 9100 ingress, business-token / ehr1, binary frames and error codes | View |
| metrics.html | Full field reference (including research fields) | View |
| File | Type | Description | Action |
|---|---|---|---|
| js_simple.html | Web frontend | Browser camera streaming (token in query; gateway required in strict mode) | View / Download |
| python_simple.py | Python | OpenCV capture and binary frame streaming (Authorization header) | Download |
| rtsp_simple.html | Web tool | RTSP start/stop console (uses the server-returned stream_id) | View / Download |
Available clients: the official web product, the official Android app, and WebSocket clients on any platform. White-labeling is offered via the WebSocket API and Android app; native SDKs are delivered per project.