Connection and device identity
Your integration provides the receiving API/server. The device initiates a WebSocket connection to that server. Keep one bidirectional connection per device for boot information, Connection Ping, settings, validation, status, live samples, and complete results.
This is a placeholder, not a real service address. Agree the host and endpoint path with the device integration team. Use secure WebSocket transport for hosted environments.
- Accept the device connection and initial
Boot_report. - Read
Data.Serial numberand associate it with the connection. - Keep receiving messages while settings may be sent on the same socket.
- Use the current registered connection when addressing a device.
The operator's dashboard communicates with your server, not directly with the device. Dashboard-to-server REST endpoints belong to your CRM implementation; they are not separate device REST connections.
Example boot report
One common JSON envelope
Use these exact top-level keys: Protocol version, Message type, Timestamp, and Data. The protocol examples use version 1 and ISO 8601 UTC timestamps.
Retain field spelling, spaces, capitalization, and underscores. In particular, settings message names use lower-case settings, as in Therapy_settings.
Send settings on the registered socket
Select an available, communicating device without a blocking service or hardware issue. Send its activity-specific settings on its existing connection. Do not assume successful socket transmission means the device accepted the settings.
CellAirOne therapy phase and preconditioning times are in minutes. Hyperoxia Duration is also in minutes. Phase 3 is used for three-phase therapy types; Slope is sent for manual mode by the example workflow. HT1 sends patient name and SpO2; HT2, HRV, and BOLT send patient name only.
For Cellit, agree time units with the firmware contract: the original simulator forwards legacy numeric time settings unchanged. A server-side field name alone is not a unit conversion. Device-specific ranges and combinations are validated by the device.
CellAirOne message families
| Activity | Settings sent | Live message | Complete message |
|---|
Receive validation and device status
The device reports Therapy_settings_validation with Approved, Message, and Errors. Display rejections with their field and description. An accepted configuration is followed by a RESERVED device status. The activity starts locally on the device, which reports RUNNING.
Device status is not connection status
Device states include AVAILABLE, RESERVED, RUNNING, PAUSED, STOPPED, COMPLETED, ATTENTION, and ERROR. Handle a Device_status message or the device status in an activity update. Do not infer that a device is running merely because settings were sent.
Receive live measurement batches
Read Data.samples as an array, not as a single flat measurement. Each entry includes sampleNo, an activity-specific time field, and nested data. Recognize the serial number from Device_Name in sample data, or from the already associated connection.
| Activity | Sample time | Measurement fields |
|---|---|---|
| Cellit / Therapy | Curr_Second | Curr_SpO2, Curr_ActualO2, Curr_HR; CellAirOne adds Curr_RMSSD |
| Hyperoxia | Curr_H_Therapy_Second | Curr_SpO2_val, Curr_Oxyg_val, Curr_HR_val |
| HT1 | Curr_Test_second | SpO2, ActualO2, PlannedO2, HR |
| HT2 | Curr_Test_second | SpO2, HR, phase_Nr, Phase1_sec, Phase2_sec |
| HRV | Curr_Test_second | Curr_HR_Val_from_HRV, Curr_RMSSD, HRVtest_RR |
| BOLT | Hold_Breath_Secs | Hold_Breath_Secs |
Preserve device metadata, alarms, sensor flags, phase data, and RR interval arrays. RMSSD and RR intervals are device-reported values; the presentation does not calculate clinical results. Missing or null values must not be shown as measured zeroes.
After a connection interruption
A message may contain multiple pending samples. Order and merge them by activity time and sample identity. Do not discard a reconnect batch because it begins with an earlier second. Keep new activities separate from previous ones.
Receive one complete activity dataset
At the end of the activity, the device sends one complete JSON message using the corresponding _fulldata message type. Preserve the full sample sequence, totalSamples, and all activity-specific final fields. This is distinct from ongoing live updates.
These examples are shortened for readability. The actual final message contains the complete recorded dataset. Therapy completed sample wrappers use currSecond; other activities retain their own timer keys.
HT1 final fields include O2_Level_Arx, SpO2Goal, SecondsToSpO2Goal, O2_Level_On_Goal, and TerminationReason. HT2 includes SpO2_Baseline, Seconds_To_SpO2_Goal, Seconds_To_SpO2_Baseline, and TerminationReason. HRV also reports its termination reason. Retain null results and zero-sample messages without inventing measurements.
Connection Ping and transport keepalive
Regular JSON Ping messages refresh server-side connection availability. The demonstrated device workflow uses approximately one-second Connection Ping updates. Recognized device activity updates also refresh the server's last-received activity time.
| Server time since last received activity | Connection state |
|---|---|
| Under 5 seconds | CONNECTION_GOOD |
| 5 to under 10 seconds | CONNECTION_PROBLEM |
| 10 seconds or more | OFFLINE |
A new message restores the relevant connection state. Measure receipt time on the server instead of relying on the device clock. These states do not themselves define whether a therapy is running or completed.
WebSocket protocol Ping/Pong control frames are separate from the JSON Ping message. Keep the device's receive loop active so its WebSocket implementation can handle transport control frames. A JSON message named Pong does not replace a transport-level Pong frame.
Client integration checklist
- Provide an agreed secure WebSocket endpoint and keep one connection per device.
- Associate the boot serial number with the device connection.
- Receive Connection Ping and activity messages continuously.
- Route the exact settings message to the selected device.
- Display validation results and device-reported status changes.
- Handle activity-specific measurement names, batched samples, and null values.
- Receive and preserve the complete final JSON and activity results.
- Test interruption, reconnection, rejected settings, and new activity boundaries.
- Agree access control, data ownership, privacy, persistence, and final-transfer confirmation with the integration team; these are not provided by this illustrative website.
All names, serials, addresses, values, and measurements on this site are examples. The example settings are not clinical recommendations. Device-specific firmware contracts govern a real integration.
Back to communication demo