Skip to main content
Connect a subscriber — a device, or an application acting for it — to the Melody server and receive signals. The device must already be linked to a Melody account.

1. Obtain an authentication token

This page describes the flow a device performs, not an application. The credential below, the device token, is issued to the device itself: firmware exchanges the system token it received during factory activation for one at POST /api/haptics/device/device_token. If you are building an application that controls a device, you do not handle it — use the session token and X-Device-Key described in Organization access.
Request a short-lived session token and server endpoint from the subscriber auth endpoint. The request carries no body: the device authenticates with its device token in the Authorization header, and the subscription is resolved from that token.
The token must be a device-scoped key; anything else is rejected with 401. The response contains the WebSocket endpoint and a token to connect with:
ws_proxy_endpoint is deprecated — use ws_endpoint.

2. Connect and authenticate

Connect to the Melody server over WebSocket and send a HapticFrame carrying a Protobuf Auth message. Open the connection:
Send the authentication frame:

3. Receive signals

Read frames from the stream and dispatch on the frame type. Always echo TIME_SYNC frames back so the server can measure round-trip latency.
That is the whole subscriber flow: connect, authenticate, read signals.