This is a step-by-step guide to connecting a publisher application to the Haptics server and transmitting signals. It assumes your device is already linked to a Melody account.
1. Obtain an authentication token
Request a short-lived authentication token and server endpoint from the App Publisher Auth endpoint (see the API Reference).
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. Handle TimeSync
Echo TIME_SYNC frames back so clients can control the quality of the stream, and react to CONNECTION_INFO events.
4. Submit signals
Build a HapticSignal from one or more DeviceCommands, marshal it, wrap it in a SIGNAL frame, and write it to the stream.
This connects a publisher to the Haptics server, authenticates it, and transmits signals to subscribers. To receive signals instead, see the Subscription Flow.