mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-12 15:04:52 +09:00
Update to master to support server wide alerts
This commit is contained in:
1 parent
84aaae05c2
commit
dc19457471
1 file changed
+15
@@ -950,6 +950,16 @@ class wsSlave {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
this.socket.on("alert", alert => {
|
||||
if(typeof alert === "object"){
|
||||
alert.timestamp = Date.now();
|
||||
if(!global.wsAlertRecievers) global.wsAlertRecievers = [];
|
||||
global.wsAlertRecievers.forEach(socket => {
|
||||
socket.emit("alert", alert);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
runCommand(command, callback){
|
||||
let commandID = Math.random().toString();
|
||||
@@ -1003,6 +1013,11 @@ io.on('connection', function (socket) {
|
||||
if(!global.wsChatRecievers) global.wsChatRecievers = [];
|
||||
global.wsChatRecievers.push(socket);
|
||||
});
|
||||
socket.on("registerAlertReciever", function(data){
|
||||
prometheusWsUsageCounter.labels("registerAlertReciever").inc();
|
||||
if(!global.wsAlertRecievers) global.wsAlertRecievers = [];
|
||||
global.wsAlertRecievers.push(socket);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
Reference in new issue
Block a user