close(code, data, mask, cb) {
        let buf;
        if (code === undefined) buf = $246d272a9ba49ed8$require$EMPTY_BUFFER;
        else if (typeof code !== 'number' || !$246d272a9ba49ed8$require$isValidStatusCode(code)) throw new TypeError('First argument must be a valid error code number');
        else if (data === undefined || data === '') {
            buf = Buffer.allocUnsafe(2);
            buf.writeUInt16BE(code, 0);
        } else {
            const length = Buffer.byteLength(data);
            if (length > 123) throw new RangeError('The message must not be greater than 123 bytes');
            buf = Buffer.allocUnsafe(2 + length);
            buf.writeUInt16BE(code, 0);
            buf.write(data, 2);
        }
        if (this._deflating) this.enqueue([
            this.doClose,
            buf,
            mask,
            cb
        ]);
        else this.doClose(buf, mask, cb);
    }
/**
   * Sends a close message to the other peer.
   *
   * @param {Number} [code] The status code component of the body
   * @param {String} [data] The message component of the body
   * @param {Boolean} [mask=false] Specifies whether or not to mask the message
   * @param {Function} [cb] Callback
   * @public
   */
Sends a close message to the other peer.
Sends a close message to the other peer .
close(code, data, mask, cb) {
        let buf;
        if (code === undefined) buf = $246d272a9ba49ed8$require$EMPTY_BUFFER;
        else if (typeof code !== 'number' || !$246d272a9ba49ed8$require$isValidStatusCode(code)) throw new TypeError('First argument must be a valid error code number');
        else if (data === undefined || data === '') {
            buf = Buffer.allocUnsafe(2);
            buf.writeUInt16BE(code, 0);
        } else {
            const length = Buffer.byteLength(data);
            if (length > 123) throw new RangeError('The message must not be greater than 123 bytes');
            buf = Buffer.allocUnsafe(2 + length);
            buf.writeUInt16BE(code, 0);
            buf.write(data, 2);
        }
        if (this._deflating) this.enqueue([
            this.doClose,
            buf,
            mask,
            cb
        ]);
        else this.doClose(buf, mask, cb);
    }
close ( code , data , mask , cb ) { let buf ; if ( code === undefined ) buf = $246d272a9ba49ed8$require$EMPTY_BUFFER ; else if ( typeof code !== 'number' || ! $246d272a9ba49ed8$require$isValidStatusCode ( code ) ) throw new TypeError ( 'First argument must be a valid error code number' ) ; else if ( data === undefined || data === '' ) { buf = Buffer . allocUnsafe ( 2 ) ; buf . writeUInt16BE ( code , 0 ) ; } else { const length = Buffer . byteLength ( data ) ; if ( length > 123 ) throw new RangeError ( 'The message must not be greater than 123 bytes' ) ; buf = Buffer . allocUnsafe ( 2 + length ) ; buf . writeUInt16BE ( code , 0 ) ; buf . write ( data , 2 ) ; } if ( this . _deflating ) this . enqueue ( [ this . doClose , buf , mask , cb ] ) ; else this . doClose ( buf , mask , cb ) ; }
Sends a close message to the other peer.
Sends a close message to the other peer .