How to use the faye/src/util/promise.all function in faye

To help you get started, we’ve selected a few faye examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GetStream / stream-js / test / integration / index.js View on Github external
var msgCallback = function(message) {
      if( message && message['new'] && message['new'].length > 0) {
        messages += 1;
      }

      if( messages == N_MESSAGES ) {
        done();
      }
    };

    var httpCallback = function(error, response, body) {
      if(error) done(error);
      if(response.statusCode !== 201) done(body);
    };

    Promise.all([
      testUser1.subscribe(msgCallback),
      testUser2.subscribe(msgCallback),
      testUser3.subscribe(msgCallback)
    ]).then(function() {
      testUser1.addActivity(activity, httpCallback);
      testUser2.addActivity(activity, httpCallback);
      testUser3.addActivity(activity, httpCallback);
    }, done);
  });

faye

Simple pub/sub messaging for the web

Apache-2.0
Latest version published 4 years ago

Package Health Score

76 / 100
Full package analysis