mirror of
https://github.com/pawelmalak/flame.git
synced 2026-02-28 01:13:11 +08:00
Added WebSockets with funcionality to send messages from any module
This commit is contained in:
20
Sockets.js
Normal file
20
Sockets.js
Normal 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();
|
||||
Reference in New Issue
Block a user