close(code, data) {
        if (this.readyState === $bb7af8e8d7184be0$var$WebSocket.CLOSED) return;
        if (this.readyState === $bb7af8e8d7184be0$var$WebSocket.CONNECTING) {
            const msg = 'WebSocket was closed before the connection was established';
            return $bb7af8e8d7184be0$var$abortHandshake(this, this._req, msg);
        }
        if (this.readyState === $bb7af8e8d7184be0$var$WebSocket.CLOSING) {
            if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
            return;
        }
        this._readyState = $bb7af8e8d7184be0$var$WebSocket.CLOSING;
        this._sender.close(code, data, !this._isServer, (err)=>{
            //
            // This error is handled by the `'error'` listener on the socket. We only
            // want to know if the close frame has been sent here.
            //
            if (err) return;
            this._closeFrameSent = true;
            if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
        });
        //
        // Specify a timeout for the closing handshake to complete.
        //
        this._closeTimer = setTimeout(this._socket.destroy.bind(this._socket), $bb7af8e8d7184be0$var$closeTimeout);
    }
/**
   * Start a closing handshake.
   *
   *          +----------+   +-----------+   +----------+
   *     - - -|ws.close()|-->|close frame|-->|ws.close()|- - -
   *    |     +----------+   +-----------+   +----------+     |
   *          +----------+   +-----------+         |
   * CLOSING  |ws.close()|<--|close frame|<--+-----+       CLOSING
   *          +----------+   +-----------+   |
   *    |           |                        |   +---+        |
   *                +------------------------+-->|fin| - - - -
   *    |         +---+                      |   +---+
   *     - - - - -|fin|<---------------------+
   *              +---+
   *
   * @param {Number} [code] Status code explaining why the connection is closing
   * @param {String} [data] A string explaining why the connection is closing
   * @public
   */
Start a closing handshake.

@param {Number} [code] Status code explaining why the connection is closing
@param {String} [data] A string explaining why the connection is closing
@public
Start a closing handshake . @param { Number } [ code ] Status code explaining why the connection is closing @param { String } [ data ] A string explaining why the connection is closing @public
close(code, data) {
        if (this.readyState === $bb7af8e8d7184be0$var$WebSocket.CLOSED) return;
        if (this.readyState === $bb7af8e8d7184be0$var$WebSocket.CONNECTING) {
            const msg = 'WebSocket was closed before the connection was established';
            return $bb7af8e8d7184be0$var$abortHandshake(this, this._req, msg);
        }
        if (this.readyState === $bb7af8e8d7184be0$var$WebSocket.CLOSING) {
            if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) this._socket.end();
            return;
        }
        this._readyState = $bb7af8e8d7184be0$var$WebSocket.CLOSING;
        this._sender.close(code, data, !this._isServer, (err)=>{
             This error is handled by the `'error'` listener on the socket. We only
             want to know if the close frame has been sent here.
            if (err) return;
            this._closeFrameSent = true;
            if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) this._socket.end();
        });
         Specify a timeout for the closing handshake to complete.
        this._closeTimer = setTimeout(this._socket.destroy.bind(this._socket), $bb7af8e8d7184be0$var$closeTimeout);
    }
close ( code , data ) { if ( this . readyState === $bb7af8e8d7184be0$var$WebSocket . CLOSED ) return ; if ( this . readyState === $bb7af8e8d7184be0$var$WebSocket . CONNECTING ) { const msg = 'WebSocket was closed before the connection was established' ; return $bb7af8e8d7184be0$var$abortHandshake ( this , this . _req , msg ) ; } if ( this . readyState === $bb7af8e8d7184be0$var$WebSocket . CLOSING ) { if ( this . _closeFrameSent && ( this . _closeFrameReceived || this . _receiver . _writableState . errorEmitted ) ) this . _socket . end ( ) ; return ; } this . _readyState = $bb7af8e8d7184be0$var$WebSocket . CLOSING ; this . _sender . close ( code , data , ! this . _isServer , ( err ) => { if ( err ) return ; this . _closeFrameSent = true ; if ( this . _closeFrameReceived || this . _receiver . _writableState . errorEmitted ) this . _socket . end ( ) ; } ) ; this . _closeTimer = setTimeout ( this . _socket . destroy . bind ( this . _socket ) , $bb7af8e8d7184be0$var$closeTimeout ) ; }
Start a closing handshake.
Start a closing handshake .
// // This error is handled by the `'error'` listener on the socket. We only // want to know if the close frame has been sent here. // // // Specify a timeout for the closing handshake to complete. //