lib/RedundantSignallingSocket.js
function disposeOfSocket(apiBase) {
        return function (error) {
            loggingService.warn("Got disconnected from signalling server (" + apiBase + ")", error);

            var socket = connectedSockets[apiBase];
            if (socket) {
                stopConnectivityChecks();
                socket.removeAllListeners();
                socket.io.removeAllListeners();
                try {
                    socket.disconnect();
                }
                catch (ignore) {
                }
                deleteSocket(apiBase);

                if (!unloadInProgress) {
                    connectAndMonitor();
                }
            }
            else {
                throw new Error("BUG ::: Disconnected from a socket we're not connected to?!");
            }
        };
    }
function disposeOfSocket(apiBase) {
        return function (error) {
            loggingService.warn("Got disconnected from signalling server (" + apiBase + ")", error);

            var socket = connectedSockets[apiBase];
            if (socket) {
                stopConnectivityChecks();
                socket.removeAllListeners();
                socket.io.removeAllListeners();
                try {
                    socket.disconnect();
                }
                catch (ignore) {
                }
                deleteSocket(apiBase);

                if (!unloadInProgress) {
                    connectAndMonitor();
                }
            }
            else {
                throw new Error("BUG ::: Disconnected from a socket we're not connected to?!");
            }
        };
    }
function disposeOfSocket ( apiBase ) { return function ( error ) { loggingService . warn ( "Got disconnected from signalling server (" + apiBase + ")" , error ) ; var socket = connectedSockets [ apiBase ] ; if ( socket ) { stopConnectivityChecks ( ) ; socket . removeAllListeners ( ) ; socket . io . removeAllListeners ( ) ; try { socket . disconnect ( ) ; } catch ( ignore ) { } deleteSocket ( apiBase ) ; if ( ! unloadInProgress ) { connectAndMonitor ( ) ; } } else { throw new Error ( "BUG ::: Disconnected from a socket we're not connected to?!" ) ; } } ; }
Return a closure that will dispose of a socket

@param apiBase
@returns {Function}
Return a closure that will dispose of a socket