Showing 1 of 2 files from the diff.

@@ -17,6 +17,7 @@
Loading
17 17
    private static counter = SocketHandler.COUNTER_START;
18 18
19 19
    protected static socketHandlers: Map<Symbol, SocketHandler> = new Map();
20 +
    protected static _handlersIds: Map<Symbol, string> = new Map();
20 21
    protected static _pendingMap: { [prop: string]: Map<string, Array<any>> } = {
21 22
        [HandlerType.SERVER]: new Map(),
22 23
        [HandlerType.SOCKET]: new Map()
@@ -35,14 +36,18 @@
Loading
35 36
    public static init(HttpServer: any,
36 37
                       socketConfig: SocketIOStatic.ServerOptions = {},
37 38
                       namespace: string = "/"): SocketIOStatic.Server {
38 -
        const id = SocketHandler.IDPrefix + this.counter++;
39 +
        const serverSymbol = Symbol.for(HttpServer);
40 +
        const id = SocketHandler._handlersIds.has(serverSymbol)
41 +
        ? SocketHandler._handlersIds.get(serverSymbol)
42 +
        : SocketHandler.IDPrefix + this.counter++;
39 43
        let socketHandler;
40 44
        if (this.socketHandlers.has(Symbol.for(id))) {
41 -
            socketHandler = this.socketHandlers.has(Symbol.for(id));
45 +
            socketHandler = this.socketHandlers.get(Symbol.for(id));
42 46
            socketHandler.addNamespace(namespace);
43 47
        } else {
44 48
            socketHandler = new this(HttpServer, id, socketConfig, namespace);
45 49
            this.socketHandlers.set(Symbol.for(id), socketHandler);
50 +
            SocketHandler._handlersIds.set(serverSymbol, id);
46 51
        }
47 52
        return socketHandler.getServer();
48 53
    }
Files Coverage
classes 89.52%
constants 100.00%
decorators 77.42%
__tests__/services/socket.service.ts 90.00%
exceptions/socket.exception.ts 100.00%
index.ts 100.00%
services/socket-handler.adapter.ts 85.23%
utils/socket.utils.ts 100.00%
Project Totals (12 files) 86.64%
74.4
TRAVIS_NODE_VERSION=11
TRAVIS_OS_NAME=linux
74.1
TRAVIS_NODE_VERSION=8
TRAVIS_OS_NAME=linux
74.5
TRAVIS_NODE_VERSION=12
TRAVIS_OS_NAME=linux
74.2
TRAVIS_NODE_VERSION=9
TRAVIS_OS_NAME=linux
75.3
TRAVIS_NODE_VERSION=10
TRAVIS_OS_NAME=linux
74.3
TRAVIS_NODE_VERSION=10
TRAVIS_OS_NAME=linux
75.2
TRAVIS_NODE_VERSION=9
TRAVIS_OS_NAME=linux
75.4
TRAVIS_NODE_VERSION=11
TRAVIS_OS_NAME=linux
75.5
TRAVIS_NODE_VERSION=12
TRAVIS_OS_NAME=linux
75.1
TRAVIS_NODE_VERSION=8
TRAVIS_OS_NAME=linux
72.3
TRAVIS_NODE_VERSION=10
TRAVIS_OS_NAME=linux
72.5
TRAVIS_NODE_VERSION=12
TRAVIS_OS_NAME=linux
72.1
TRAVIS_NODE_VERSION=8
TRAVIS_OS_NAME=linux
72.4
TRAVIS_NODE_VERSION=11
TRAVIS_OS_NAME=linux
73.5
TRAVIS_NODE_VERSION=12
TRAVIS_OS_NAME=linux
72.2
TRAVIS_NODE_VERSION=9
TRAVIS_OS_NAME=linux
73.3
TRAVIS_NODE_VERSION=10
TRAVIS_OS_NAME=linux
73.1
TRAVIS_NODE_VERSION=8
TRAVIS_OS_NAME=linux
73.2
TRAVIS_NODE_VERSION=9
TRAVIS_OS_NAME=linux
73.4
TRAVIS_NODE_VERSION=11
TRAVIS_OS_NAME=linux

No yaml found.

Create your codecov.yml to customize your Codecov experience