mirror of
https://github.com/pawelmalak/flame.git
synced 2024-12-21 01:01:30 +03:00
20 lines
338 B
JavaScript
20 lines
338 B
JavaScript
|
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();
|