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:
parent
4510a709d4
commit
38f5d3b66a
7 changed files with 84 additions and 21 deletions
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();
|
Loading…
Add table
Add a link
Reference in a new issue