send(data, options, cb) {
    if (this.readyState === WebSocket.CONNECTING) {
      throw new Error('WebSocket is not open: readyState 0 (CONNECTING)');
    }

    if (typeof options === 'function') {
      cb = options;
      options = {};
    }

    if (typeof data === 'number') data = data.toString();

    if (this.readyState !== WebSocket.OPEN) {
      sendAfterClose(this, data, cb);
      return;
    }

    const opts = {
      binary: typeof data !== 'string',
      mask: !this._isServer,
      compress: true,
      fin: true,
      ...options
    };

    if (!this._extensions[PerMessageDeflate.extensionName]) {
      opts.compress = false;
    }

    this._sender.send(data || EMPTY_BUFFER, opts, cb);
  }
Send a data message.

@param {*} data The message to send
@param {Object} [options] Options object
@param {Boolean} [options.binary] Specifies whether `data` is binary or
    text
@param {Boolean} [options.compress] Specifies whether or not to compress
    `data`
@param {Boolean} [options.fin=true] Specifies whether the fragment is the
    last one
@param {Boolean} [options.mask] Specifies whether or not to mask `data`
@param {Function} [cb] Callback which is executed when data is written out
@public