INNER CODE UNIT · JavaScript
safeSend
ClickDevTech/CELERITY-panel · index.js:850
const safeSend = (data) => {
if (ws.readyState === 1) ws.send(JSON.stringify(data));
};
const session = new BroadcastSession(ws);
safeSend({ type: 'ready' });
ws.on('message', async (message) => {
try {
const msg = JSON.parse(message.toString());
if (msg.type === 'exec') {
const command = (msg.command || '').trim();
const timeoutMs = typeof msg.timeout === 'number' ? msg.timeout * 1000 : undefined;
let nodeIds = msg.nodeIds;
let nodes;