Read Heart Rate via WebSocket
This method allows reading the heart rate of the user in real-time. The WebSocket connection can be interrupted at any point in time, make sure to have retry logic with backoff.
Request
url
wss://dev.pulsoid.net/api/v1/data/real_time
scope
data:heart_rate:read
Authentication
Provide your OAuth2 Bearer token using one of the following methods:
Query parameter
wss://dev.pulsoid.net/api/v1/data/real_time?access_token=YOUR_TOKEN
Header
Authorization: Bearer YOUR_TOKEN
Query Parameters explained:
access_token
string
OAuth2 access token (alternative to Authorization header)
Websocket URL Request Example
wss://dev.pulsoid.net/api/v1/data/real_time?access_token=8c4da3ce-7ed7-4a19-a1f1-058498661e45WebSocket Message Example
{
"measured_at": 1625310655000,
"data": {
"heart_rate": 40
}
}Websocket URL Request Example With response_mode=text_plain_only_heart_rate
WebSocket Message Example With response_mode=text_plain_only_heart_rate
JavaScript / TypeScript
For JavaScript and TypeScript applications, use the official @pulsoid/socket library instead of managing WebSocket connections manually. It provides auto-reconnection with exponential backoff, typed events, and zero dependencies.
See the GitHub repository for full documentation and configuration options.
Last updated