code: function createCloseEvent(code, reason) {
      var event = new yaeti.Event('close');
  
      event.code = code;
      event.reason = reason;
      event.wasClean = (typeof code === 'undefined' || code === 1000);
  
      return event;
  }
docs: Private API.