Minescope Demo API
Shared x/y (0–1 device coordinates) and boolean states, streamed over one WebSocket.
Click or drag in the square to send coordinates. (0, 0) is top-left.
Click a state to toggle it.
All paths are relative to .
| Path | Key | What |
|---|---|---|
/ | no | This page (asks for the key) |
/ws | yes | The WebSocket: send updates, receive every change (see Protocol below) |
/state | yes | Current state as JSON, read-only |
/health | no | {"ok": true, "clients": n, "num_states": n} |
State is kept in memory only. When the service restarts it resets to x = y = 0.5 with every state off.
Connect to . Every client can send updates, and every change goes to every connected client (the sender included). Each message is one text frame, written as JSON or as a plain-text line.
| Send (JSON) | Send (plain text) | Effect |
|---|---|---|
{"type":"xy","x":0.25,"y":0.75} | xy 0.25 0.75 | Set coordinates (each 0–1) |
{"type":"state","index":2,"on":true} | state 2 true | Set one state (true or false) |
{"type":"get"} | get | Reply with a snapshot to you only |
| Receive | When |
|---|---|
{"type":"snapshot","x":…,"y":…,"states":[…]} | On connect, and in reply to get |
{"type":"xy","x":…,"y":…} | Anyone changed the coordinates |
{"type":"state","index":…,"on":…,"states":[…]} | Anyone changed a state |
{"type":"error","error":"…"} | Your last message was rejected |
Echo: by default you also receive your own updates. Connect to /ws?echo=false to get only other clients' updates; errors still come back to you.
Auth: send Authorization: Bearer <key>, X-API-Key: <key>, or add ?key=<key> to the URL. Browsers can't set headers on a WebSocket handshake, so this page uses the query string.
These use your key once you've typed it above. Leave the field empty to see a placeholder.