vox-common/connection-manager.js
function sendCommand(method, url, payload, skipQueue) {
    if (!self.connected) {
      debug('Queueing %s %s', method, url);
      return new P(function(resolve, reject) {
        var p = P.method(function() {
          debug('Dequeueing %s %s', method, url);
          return _sendCommand(method, url, payload)
            .then(resolve)
            .catch(reject);
        });
        if (skipQueue) {
          pendingCommands.splice(0, 0, p);
        } else {
          pendingCommands.push(p);
        }
      });
    }
    return _sendCommand(method, url, payload);
  }
function sendCommand(method, url, payload, skipQueue) {
    if (!self.connected) {
      debug('Queueing %s %s', method, url);
      return new P(function(resolve, reject) {
        var p = P.method(function() {
          debug('Dequeueing %s %s', method, url);
          return _sendCommand(method, url, payload)
            .then(resolve)
            .catch(reject);
        });
        if (skipQueue) {
          pendingCommands.splice(0, 0, p);
        } else {
          pendingCommands.push(p);
        }
      });
    }
    return _sendCommand(method, url, payload);
  }
function sendCommand ( method , url , payload , skipQueue ) { if ( ! self . connected ) { debug ( 'Queueing %s %s' , method , url ) ; return new P ( function ( resolve , reject ) { var p = P . method ( function ( ) { debug ( 'Dequeueing %s %s' , method , url ) ; return _sendCommand ( method , url , payload ) . then ( resolve ) . catch ( reject ) ; } ) ; if ( skipQueue ) { pendingCommands . splice ( 0 , 0 , p ) ; } else { pendingCommands . push ( p ) ; } } ) ; } return _sendCommand ( method , url , payload ) ; }
Helper function to send a command to the server.

Returns a Promise for the server's response.  Rejects the Promise if the
reply's status is not 200.

If this connection is not ready to receive commands, the command is queued
for later execution.
Helper function to send a command to the server .