Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.server.clients.forEach(client => {
if(client.readyState !== WebSocket.OPEN)
return
try {
client.send(dataString)
} catch(error) {
console.error(chalk.bold('LiveReload error: Sending data to a client...'))
console.error(chalk.red(error))
}
})
}
this.wss.clients.forEach(client => {
if (client.readyState === uws.OPEN) {
try {
client.ping();
} catch (e) {
console.log(e);
}
}
});
};
sendWS(op, data) {
if (this.ws && this.ws.readyState === WebSocket.OPEN) {
data = JSON.stringify({ op: op, d: data });
this.ws.send(data);
this.emit('debug', data);
}
}
this.wss.clients.forEach(client => {
if (client.readyState === uws.OPEN) {
try {
client.send(data);
} catch (e) {
console.log(e);
}
}
});
};
server.clients.forEach((client) =>
{
if (client.readyState === WebSocket.OPEN)
{
client.send(message)
}
})
}
this.wss.clients.forEach(socket => {
if (socket.readyState === WebSocket.OPEN) {
socket.send(message)
}
});
}