feat: do not store each infos of each node

This commit is contained in:
2025-10-01 20:45:55 +02:00
parent dbb3b5bfd3
commit 99e7ed4809
6 changed files with 6 additions and 23 deletions

View File

@@ -44,7 +44,7 @@ console.log(`Broadcasting color changes to http://${host}/api/cluster/event ...`
setInterval(() => {
const color = colors[idx % colors.length];
idx++;
const payload = { color, brightness: 128 };
const payload = { color, brightness: 80 };
console.log('Broadcasting color:', payload);
postClusterEvent('api/neopattern/color', payload);
}, 5000);

View File

@@ -15,7 +15,7 @@ ws.on('open', () => {
setInterval(() => {
const color = colors[idx % colors.length];
idx++;
const payload = { color, brightness: 128 };
const payload = { color, brightness: 80 };
const envelope = {
event: 'api/neopattern/color',
data: payload // server will serialize object payloads

View File

@@ -31,7 +31,7 @@ function toHex({ r, g, b }) {
let hue = 0;
const SAT = 1.0; // full saturation
const VAL = 1.0; // full value
const BRIGHTNESS = 128;
const BRIGHTNESS = 80;
const UPDATE_RATE = 100; // ms
let timer = null;

View File

@@ -22,7 +22,7 @@ ws.on('open', () => {
setInterval(() => {
const color = colors[idx % colors.length];
idx++;
const payload = { color, brightness: 128 };
const payload = { color, brightness: 80 };
// Send payload as an object (server supports string or object)
const msg = { event: 'api/neopattern/color', payload };
ws.send(JSON.stringify(msg));