Skip to main content
This is a step-by-step guide to connecting a subscriber — a device, or an application acting on its behalf — to the Haptics server and receiving signals. It assumes the device is already linked to a Melody account.

1. Obtain an authentication token

Request a short-lived authentication token and server endpoint from the Subscriber Auth API (see the API Reference). Use the Device Subscriber endpoint for a device connecting directly, or the App Subscriber endpoint when an intermediate application connects on the device’s behalf.
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 Haptics 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 and manage stream quality.
This connects a subscriber to the Haptics server, authenticates it, and receives signals for further processing. To transmit signals instead, see the Publication Flow.