mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-20 07:43:12 +09:00
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:
1 parent
21d9fdff7b
commit
e5115df28b
4 files changed
+65
-1
No files matched your search
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user