code: function sendAfterClose(websocket, data, cb) {
    if (data) {
      const length = toBuffer(data).length;
  
      //
      // The `_bufferedAmount` property is used only when the peer is a client and
      // the opening handshake fails. Under these circumstances, in fact, the
      // `setSocket()` method is not called, so the `_socket` and `_sender`
      // properties are set to `null`.
      //
      if (websocket._socket) websocket._sender._bufferedBytes += length;
      else websocket._bufferedAmount += length;
    }
  
    if (cb) {
      const err = new Error(
        `WebSocket is not open: readyState ${websocket.readyState} ` +
          `(${readyStates[websocket.readyState]})`
      );
      cb(err);
    }
  }
docs: Handle cases where the `ping()`, `pong()`, or `send()` methods are called
  when the `readyState` attribute is `CLOSING` or `CLOSED`.
  
  @param {WebSocket} websocket The WebSocket instance
  @param {*} data The data to send
  @param {Function} cb Callback
  @private