How to use the chimp.ddp function in chimp

To help you get started, we’ve selected a few chimp 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 TheBrainFamily / chimpy / dist / lib / chimp-helper.js View on Github external
call: noDdp,
          apply: noDdp,
          execute: noDdp
        };
        log.debug('[chimp][helper] DDP not required');
      }
    };

    var configureChimpWidgetsDriver = function configureChimpWidgetsDriver() {
      widgets.driver.api = global.browser;
    };

    try {
      setupBrowser();
      initBrowser();
      if (booleanHelper.isTruthy(process.env['chimp.ddp'])) {
        setupDdp();
      }
      configureChimpWidgetsDriver();
    } catch (error) {
      log.error('[chimp][helper] setupBrowserAndDDP had error');
      log.error(error);
      log.error(error.stack);
      exit(2);
    }
  },
github TheBrainFamily / chimpy / dist / lib / chimp-helper.js View on Github external
var setupDdp = function setupDdp() {
      log.debug('[chimp][helper] setup DDP');
      if (process.env['chimp.ddp']) {
        log.debug('[chimp][helper] connecting via DDP to', process.env['chimp.ddp']);
        try {
          global.ddp.connectSync();
          addServerExecute();
          log.debug('[chimp][helper] connecting via DDP had no error');
        } catch (error) {
          log.error('[chimp][helper] connecting via DDP error', error);
        }
      } else {
        var noDdp = function noDdp() {
          expect('DDP Not Connected').to.equal('', 'You tried to use a DDP connection but it' + ' has not been configured. Be sure to pass --ddp=');
        };
        global.ddp = {
          call: noDdp,
          apply: noDdp,
          execute: noDdp
github TheBrainFamily / chimpy / dist / lib / chimp.js View on Github external
Chimp.prototype._startServer = function (port) {

  var server = new Hapi.Server();

  server.connection({
    host: this.options.serverHost,
    port: port,
    routes: { timeout: { server: false, socket: false } }
  });

  this._setupRoutes(server);

  server.start();

  log.info('[chimp] Chimp server is running on port', port, process.env['chimp.ddp']);

  if (booleanHelper.isTruthy(this.options.ddp)) {
    this._handshakeOverDDP();
  }
};
github TheBrainFamily / chimpy / dist / lib / chimp-helper.js View on Github external
var setupDdp = function setupDdp() {
      log.debug('[chimp][helper] setup DDP');
      if (process.env['chimp.ddp']) {
        log.debug('[chimp][helper] connecting via DDP to', process.env['chimp.ddp']);
        try {
          global.ddp.connectSync();
          addServerExecute();
          log.debug('[chimp][helper] connecting via DDP had no error');
        } catch (error) {
          log.error('[chimp][helper] connecting via DDP error', error);
        }
      } else {
        var noDdp = function noDdp() {
          expect('DDP Not Connected').to.equal('', 'You tried to use a DDP connection but it' + ' has not been configured. Be sure to pass --ddp=');
        };
        global.ddp = {
          call: noDdp,
          apply: noDdp,
          execute: noDdp
        };
github TheBrainFamily / chimpy / src / lib / chimp.js View on Github external
Chimp.prototype._startServer = function (port) {

  var server = new Hapi.Server();

  server.connection({
    host: this.options.serverHost,
    port: port,
    routes: {timeout: {server: false, socket: false}}
  });

  this._setupRoutes(server);

  server.start();

  log.info('[chimp] Chimp server is running on port', port, process.env['chimp.ddp']);

  if (booleanHelper.isTruthy(this.options.ddp)) {
    this._handshakeOverDDP();
  }

};
github TheBrainFamily / chimpy / src / lib / chimp.js View on Github external
Chimp.prototype._handshakeOverDDP = function () {
  var ddp = new DDPClient({
    host: process.env['chimp.ddp'].match(/http:\/\/(.*):/)[1],
    port: process.env['chimp.ddp'].match(/:([0-9]+)/)[1],
    ssl: false,
    autoReconnect: true,
    autoReconnectTimer: 500,
    maintainCollections: true,
    ddpVersion: '1',
    useSockJs: true
  });
  ddp.connect(function (error) {
    if (error) {
      log.error('[chimp] Error handshaking via DDP');
      throw (error);
    }
  }).then(function () {
    log.debug('[chimp] Handshaking with DDP server');
    ddp.call('handshake').then(function () {
      log.debug('[chimp] Handshake complete, closing DDP connection');
github TheBrainFamily / chimpy / dist / lib / chimp.js View on Github external
Chimp.prototype._handshakeOverDDP = function () {
  var ddp = new DDPClient({
    host: process.env['chimp.ddp'].match(/http:\/\/(.*):/)[1],
    port: process.env['chimp.ddp'].match(/:([0-9]+)/)[1],
    ssl: false,
    autoReconnect: true,
    autoReconnectTimer: 500,
    maintainCollections: true,
    ddpVersion: '1',
    useSockJs: true
  });
  ddp.connect(function (error) {
    if (error) {
      log.error('[chimp] Error handshaking via DDP');
      throw error;
    }
  }).then(function () {
    log.debug('[chimp] Handshaking with DDP server');
    ddp.call('handshake').then(function () {
      log.debug('[chimp] Handshake complete, closing DDP connection');