feat: do not store each infos of each node
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user