Implement broadcast for events

Add broadcastTo property to events that broadcasts them to all entities
of the specified target that's downstream to the connection it was sent
to.
This commit is contained in:
Hornwitser committed 2019-12-13 22:37:58 +01:00
1 parent 21d9fdff7b
commit e5115df28b
4 files changed
+65 -1

No files matched your search

+10
View File
@@ -267,6 +267,16 @@ class BaseConnection extends link.Link {
return await request.send(connection, message.data);
}
async broadcastEventToInstance(message, event) {
for (let slaveConnection of slaveConnections.values()) {
if (slaveConnection === this) {
continue; // Do not broadcast back to the source
}
event.send(slaveConnection, message.data);
}
}
}
let controlConnections = new Array();