mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-17 23:33:12 +09:00
Websockets for listening to factorio logs and global chat plugin
You can now !shout things across the cluster
This commit is contained in:
1 parent
641f980741
commit
ce0deef83b
5 files changed
+54
-1
No files matched your search
@@ -940,6 +940,16 @@ class wsSlave {
|
||||
delete this.commandsWaitingForReturn[resp.commandID];
|
||||
}
|
||||
});
|
||||
|
||||
this.socket.on("gameChat", data => {
|
||||
if(typeof data === "object"){
|
||||
data.timestamp = Date.now();
|
||||
if(!global.wsChatRecievers) global.wsChatRecievers = [];
|
||||
global.wsChatRecievers.forEach(socket => {
|
||||
socket.emit("gameChat", data);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
runCommand(command, callback){
|
||||
let commandID = Math.random().toString();
|
||||
@@ -988,7 +998,11 @@ io.on('connection', function (socket) {
|
||||
console.log("SOCKET | Created new wsSlave: "+ data.instanceID);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("registerChatReciever", function(data){
|
||||
prometheusWsUsageCounter.labels("registerChatReciever").inc();
|
||||
if(!global.wsChatRecievers) global.wsChatRecievers = [];
|
||||
global.wsChatRecievers.push(socket);
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
Reference in new issue
Block a user