docs: function(err) {
    // this set to the appropriate client via apply call in performConnect
    var client = this;
    if (typeof client === 'undefined'/* || client.constructor !== Client*/) {
      logger.entry('processQueuedActions', 'client was not set');
      logger.exit('processQueuedActions', 'client not set returning', null);
      return;
    }
    logger.entry('processQueuedActions', client.id);
    logger.log('parms', client.id, 'err:', err);
    logger.log('data', client.id, 'client.state:', client.state);
  
    if (!err) {
      var performSend = function() {
        logger.entry('performSend', client.id);
        logger.log('data', client.id, 'client._queuedSends',
                   client._queuedSends);
        while (client._queuedSends.length > 0 &&
                client.state === STATE_STARTED) {
          var remaining = client._queuedSends.length;
          var msg = client._queuedSends.shift();
          client.send(msg.topic, msg.data, msg.options, msg.callback);
          if (client._queuedSends.length >= remaining) {
            // Calling client.send can cause messages to be added back into
            // _queuedSends, if the network connection is broken.  Check that the
            // size of the array is decreasing to avoid looping forever...
            break;
          }
        }
  
        logger.exit('performSend', client.id, null);
      };
  
      var performUnsub = function() {
        logger.entry('performUnsub', client.id);
  
        if (client._queuedUnsubscribes.length > 0 &&
            client.state === STATE_STARTED) {
          var rm = client._queuedUnsubscribes.shift();
          logger.log('data', client.id, 'rm:', rm);
          if (rm.noop) {
            // no-op, so just trigger the callback without actually unsubscribing
            if (rm.callback) {
              logger.entry('performUnsub.callback', client.id);
              rm.callback.apply(client, [null, rm.topicPattern, rm.share]);
              logger.exit('performUnsub.callback', client.id, null);
            }
            setImmediate(function() {
              performUnsub.apply(client);
            });
          } else {
            client.unsubscribe(rm.topicPattern, rm.share, rm.options,
                function(err, topicPattern, share) {
                  if (rm.callback) {
                    logger.entry('performUnsub.callback', client.id);
                    rm.callback.apply(client, [err, topicPattern, share]);
                    logger.exit('performUnsub.callback', client.id, null);
                  }
                  setImmediate(function() {
                    performUnsub.apply(client);
                  });
                }
            );
          }
        } else {
          performSend.apply(client);
        }
  
        logger.exit('performUnsub', client.id, null);
      };
  
      var performSub = function() {
        logger.entry('performSub', client.id);
  
        if (client._queuedSubscriptions.length > 0 &&
            client.state === STATE_STARTED) {
          var sub = client._queuedSubscriptions.shift();
          logger.log('data', client.id, 'sub:', sub);
          if (sub.noop) {
            // no-op, so just trigger the callback without actually subscribing
            if (sub.callback) {
              process.nextTick(function() {
                logger.entry('performSub.callback', client.id);
                logger.log('parms', client.id, 'err:', err, ', topicPattern:',
                           sub.topicPattern, ', originalShareValue:', sub.share);
                sub.callback.apply(client,
                    [err, sub.topicPattern, sub.originalShareValue]);
                logger.exit('performSub.callback', client.id, null);
              });
            }
            setImmediate(function() {
              performSub.apply(client);
            });
          } else {
            client.subscribe(sub.topicPattern, sub.share, sub.options,
                function(err, topicPattern, share) {
                  if (sub.callback) {
                    process.nextTick(function() {
                      logger.entry('performSub.callback',
                                   client.id);
                      logger.log('parms', client.id, 'err:', err,
                                 ', topicPattern:', topicPattern,
                                 ', share:', share);
                      sub.callback.apply(client,
                          [err, topicPattern, share]);
                      logger.exit('performSub.callback',
                                  client.id, null);
                    });
                  }
                  setImmediate(function() {
                    performSub.apply(client);
                  });
                }
            );
          }
        } else {
          performUnsub.apply(client);
        }
  
        logger.exit('performSub', client.id, null);
      };
  
      performSub();
    }
    logger.exit('processQueuedActions', client.id, null);
  }