forked from nestjs/nest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontainer.ts
More file actions
21 lines (16 loc) · 692 Bytes
/
Copy pathcontainer.ts
File metadata and controls
21 lines (16 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { WebSocketServerData, ObservableSocketServer } from './interfaces';
export class SocketsContainer {
private readonly observableServers = new Map<string, ObservableSocketServer>();
public getAllServers(): Map<string, ObservableSocketServer> {
return this.observableServers;
}
public getServer(namespace: string, port: number): ObservableSocketServer {
return this.observableServers.get(`${namespace}:${port}`);
}
public addServer(namespace: string, port: number, server: ObservableSocketServer) {
this.observableServers.set(`${namespace}:${port}`, server);
}
public clear() {
this.observableServers.clear();
}
}