A browser cannot talk to a Melody device directly: the device speaks the WebSocket haptics protocol
to the Melody server, and the browser reaches the same server over the public API. This page shows
how the two meet.
A Developer Key must never reach the browser. Mint the short-lived session token on your own
backend and hand only that token to the page.
1. Connect the device
Connect the device to WiFi and check that it reached the server: GET /device/session answers
200 for an online device and 404 for one that is not connected. See
Connection & Time Sync.
2. Mint a session token on your backend
Exchange your Developer Key for a session token, then pass the token (and the device it is scoped
to) to the page:
The response carries the token and its lifetime in seconds. Details and the full request shape are
on Organization access.
3. Drive the device from the page
Two ways, depending on what you need:
Call the device-control endpoints with the session token and the device key:
That covers play, pause, seek and direct position moves — the full field reference is in
Playback Protocols. For a continuous point stream, send points
with POST /device/hps/signal and start playback with POST /device/hps/play; the WebSocket
protocol is for devices, not for browser clients.