Matti Gruener Minescope · Demo API

Minescope Demo API

Shared x/y (0–1 device coordinates) and boolean states, streamed over one WebSocket.

● disconnected
Position
x = 0x = 1
x = –, y = –

Click or drag in the square to send coordinates. (0, 0) is top-left.

States

Click a state to toggle it.

Endpoints

All paths are relative to .

PathKeyWhat
/noThis page (asks for the key)
/wsyesThe WebSocket: send updates, receive every change (see Protocol below)
/stateyesCurrent state as JSON, read-only
/healthno{"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.

Protocol

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.75Set coordinates (each 0–1)
{"type":"state","index":2,"on":true}state 2 trueSet one state (true or false)
{"type":"get"}getReply with a snapshot to you only
ReceiveWhen
{"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.

Examples

These use your key once you've typed it above. Leave the field empty to see a placeholder.