docs: function _send(sync, messages, metaConnect, extraPath) {
          // We must be sure that the messages have a clientId.
          // This is not guaranteed since the handshake may take time to return
          // (and hence the clientId is not known yet) and the application
          // may create other messages.
          for (var i = 0; i < messages.length; ++i) {
              var message = messages[i];
              var messageId = message.id;
  
              if (_clientId) {
                  message.clientId = _clientId;
              }
  
              message = _applyOutgoingExtensions(message);
              if (message !== undefined && message !== null) {
                  // Extensions may have modified the message id, but we need to own it.
                  message.id = messageId;
                  messages[i] = message;
              } else {
                  delete _callbacks[messageId];
                  messages.splice(i--, 1);
              }
          }
  
          if (messages.length === 0) {
              return;
          }
  
          var url = _cometd.getURL();
          if (_config.appendMessageTypeToURL) {
              // If url does not end with '/', then append it
              if (!url.match(/\/$/)) {
                  url = url + '/';
              }
              if (extraPath) {
                  url = url + extraPath;
              }
          }
  
          var envelope = {
              url: url,
              sync: sync,
              messages: messages,
              onSuccess: function(rcvdMessages) {
                  try {
                      _handleMessages.call(_cometd, rcvdMessages);
                  } catch (x) {
                      _cometd._info('Exception during handling of messages', x);
                  }
              },
              onFailure: function(conduit, messages, failure) {
                  try {
                      var transport = _cometd.getTransport();
                      failure.connectionType = transport ? transport.getType() : "unknown";
                      _handleFailure.call(_cometd, conduit, messages, failure);
                  } catch (x) {
                      _cometd._info('Exception during handling of failure', x);
                  }
              }
          };
          _cometd._debug('Send', envelope);
          _transport.send(envelope, metaConnect);
      }