Skip to content
OBEGRÄNSAD LED

WebSocket

The Web GUI talks to the device over a WebSocket at ws://<device-ip>/ws. You can use the same connection in your own tools, for example to drive the Draw plugin or to mirror the display.

Messages from the client are JSON objects with an event field. Messages without event are ignored.

const ws = new WebSocket('ws://192.168.1.50/ws')
ws.onopen = () => ws.send(JSON.stringify({ event: 'plugin', plugin: 34 }))
ws.onmessage = (message) => {
  if (typeof message.data === 'string') console.log(JSON.parse(message.data))
}

Server messages

info

The device sends an info event when a client connects and after every change of plugin, brightness, rotation, power or schedule. It has the display fields of GET /api/info (status, plugin, rotation, power, brightness, schedule and plugins). It does not include rows, cols, mqttConnected or the system fields like rssi and uptime. Extra fields:

FieldDescription
eventinfo
dataCurrent frame, 256 brightness values.
persist-pluginID of the plugin that starts after boot.

Live frames

Every connected client receives each new frame as a binary message of 256 bytes, one brightness value per pixel, row by row. Send live-preview with enabled: false to stop them.

Client events

EventFieldsDescription
infoRequest an info event.
pluginplugin: IDActivate a plugin. Stops the plugin schedule, the stored schedule is kept.
persist-pluginStart the active plugin after boot.
rotatedirection: left or rightRotate by 90°.
brightnessbrightness: 0–255Set the base brightness.
brightness-scheduleenabled, startTime, endTime, brightnessConfigure scheduled brightness.
powerpower: true or falseTurn the display on or off. Without power it toggles.
live-previewenabled: true or falseTurn the binary live frames on or off for this client.
{ "event": "rotate", "direction": "right" }
{ "event": "power", "power": false }

Plugin events

These events are handled by the active plugin. They are ignored when another plugin runs.

Draw plugin

EventFieldsDescription
ledindex: 0–255, status: 0 or 1Set one pixel.
screendata: 256 valuesDraw a full frame.
clearClear the display.
persistSave the drawing.
loadLoad the saved drawing.
{ "event": "led", "index": 17, "status": 1 }

Animation plugin

The Animation plugin plays frames from the Animation Creator. Each frame is an array of 32 integers. Each integer holds 8 pixels as bits, so a frame covers all 256 pixels. Up to 128 frames are kept in memory.

EventFieldsDescription
uploadscreens: count, data: array of frames, frameDelayReplace all frames.
resetFramesframeDelayDelete all frames.
addFramedata: one frameAppend a frame.
configAnimationframeDelayChange the delay between frames.
animationStatusThe device answers with animationStatus, screens and frameDelay.

frameDelay is in milliseconds and is limited to 10–10000.

Game of Life plugin

{ "event": "goldelay", "delay": 200 }

Sets the delay between generations in milliseconds.

ArtNet plugin

{ "event": "artnet", "universe": 2 }

Sets the Art-Net universe. See Art-Net.

Binary input

Binary messages are not supported as input. To push full frames, use the Draw screen event or DDP.