onclose(callback) {
        if (callback) {
            this._closedCallbacks.push(callback);
        }
    }
/** Registers a handler that will be invoked when the connection is closed.
     *
     * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
     */
Registers a handler that will be invoked when the connection is closed.
@param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).
Registers a handler that will be invoked when the connection is closed . @param { Function } callback The handler that will be invoked when the connection is closed . Optionally receives a single argument containing the error that caused the connection to close ( if any ) .
onclose(callback) {
        if (callback) {
            this._closedCallbacks.push(callback);
        }
    }
onclose ( callback ) { if ( callback ) { this . _closedCallbacks . push ( callback ) ; } }
Registers a handler that will be invoked when the connection is closed.
Registers a handler that will be invoked when the connection is closed .