mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
d360f30af6
commit
d583c68de5
@ -194,21 +194,24 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
WebSocketListenerNode.prototype.broadcast = function(data) {
|
||||
try {
|
||||
if (this.isServer) {
|
||||
for (let client in this._clients) {
|
||||
if (this._clients.hasOwnProperty(client)) {
|
||||
try {
|
||||
this._clients[client].send(data);
|
||||
} catch(err) {
|
||||
this.warn(RED._("websocket.errors.send-error")+" "+client+" "+err.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
this.server.send(data);
|
||||
} catch(err) {
|
||||
this.warn(RED._("websocket.errors.send-error")+" "+err.toString())
|
||||
}
|
||||
}
|
||||
catch(e) { // swallow any errors
|
||||
this.warn("ws:"+i+" : "+e);
|
||||
}
|
||||
}
|
||||
|
||||
WebSocketListenerNode.prototype.reply = function(id,data) {
|
||||
|
Loading…
Reference in New Issue
Block a user