Skip to content

Commit

Permalink
Merge pull request nestjs#237 from hicdre/master
Browse files Browse the repository at this point in the history
Map key should not be object
  • Loading branch information
kamilmysliwiec authored Nov 10, 2017
2 parents 81a75fc + 15403ba commit c9621c1
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/websockets/container.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
import { WebSocketServerData, ObservableSocketServer } from './interfaces';

export class SocketsContainer {
private readonly observableServers = new Map<WebSocketServerData, ObservableSocketServer>();
private readonly observableServers = new Map<string, ObservableSocketServer>();

public getAllServers(): Map<WebSocketServerData, ObservableSocketServer> {
public getAllServers(): Map<string, ObservableSocketServer> {
return this.observableServers;
}

public getServer(namespace: string, port: number): ObservableSocketServer {
return this.observableServers.get({
namespace,
port,
});
return this.observableServers.get(`${namespace}:${port}`);
}

public addServer(namespace: string, port: number, server: ObservableSocketServer) {
this.observableServers.set({
namespace,
port,
}, server);
this.observableServers.set(`${namespace}:${port}`, server);
}

public clear() {
Expand Down

0 comments on commit c9621c1

Please sign in to comment.