bin/socketpool.js
function runAsyncMiddleware(wares, event, payload, callback) {
  if (wares.length) {
    var ware = wares[0];
    var restWares = wares.slice(1);
    ware(event, payload, function () {
      runAsyncMiddleware(restWares, event, payload, callback);
    });
  } else {
    callback && callback(payload);
  }
}
function runAsyncMiddleware(wares, event, payload, callback) {
  if (wares.length) {
    var ware = wares[0];
    var restWares = wares.slice(1);
    ware(event, payload, function () {
      runAsyncMiddleware(restWares, event, payload, callback);
    });
  } else {
    callback && callback(payload);
  }
}
function runAsyncMiddleware ( wares , event , payload , callback ) { if ( wares . length ) { var ware = wares [ 0 ] ; var restWares = wares . slice ( 1 ) ; ware ( event , payload , function ( ) { runAsyncMiddleware ( restWares , event , payload , callback ) ; } ) ; } else { callback && callback ( payload ) ; } }
Executes each function in a list of asynchronous functions. Each one
is given an argument we call `next`. The only way to get to the next
function in the list is to call `next`. If you don't, the process is
halted.

@param  {Array}    wares    A list of possibly asynchronous functions.
@param  {String}   event    The name of a socket event.
@param  {Any}      payload  The body of the socket message.
@param  {Function} callback A function to run after all middleware is executed.

@return {undefined}
Executes each function in a list of asynchronous functions . Each one is given an argument we call next . The only way to get to the next function in the list is to call next . If you don t the process is halted .