1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-19 03:29:37 +02:00

Added WebSockets with funcionality to send messages from any module

This commit is contained in:
unknown 2021-05-19 17:17:24 +02:00
parent 4510a709d4
commit 38f5d3b66a
7 changed files with 84 additions and 21 deletions

20
Sockets.js Normal file
View file

@ -0,0 +1,20 @@
class Sockets {
constructor() {
this.sockets = [];
}
registerSocket(name, socket) {
this.sockets.push({ name, socket });
}
getAllSockets() {
return this.sockets;
}
getSocket(name) {
const socket = this.sockets.find(socket => socket.name === name);
return socket;
}
}
module.exports = new Sockets();