Sha256: 412d2dbeba873a06fb11d1e15f46455eb0b74383821a081e275c84d570d5e962

Contents?: true

Size: 934 Bytes

Versions: 29

Compression:

Stored size: 934 Bytes

Contents

var WebSocket = require('..').Client,
    deflate   = require('permessage-deflate'),
    pace      = require('pace');

var host    = 'ws://localhost:9001',
    agent   = encodeURIComponent('node-' + process.version),
    cases   = 0,
    options = {extensions: [deflate]};

var socket = new WebSocket(host + '/getCaseCount'),
    url, progress;

socket.onmessage = function(event) {
  console.log('Total cases to run: ' + event.data);
  cases = parseInt(event.data);
  progress = pace(cases);
};

var runCase = function(n) {
  if (n > cases) {
    url = host + '/updateReports?agent=' + agent;
    socket = new WebSocket(url);
    socket.onclose = process.exit;
    return;
  }

  url = host + '/runCase?case=' + n + '&agent=' + agent;
  socket = new WebSocket(url, [], options);
  socket.pipe(socket);

  socket.on('close', function() {
    progress.op();
    runCase(n + 1);
  });
};

socket.onclose = function() {
  runCase(1);
};

Version data entries

29 entries across 24 versions & 11 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/faye-websocket/examples/autobahn_client.js
disco_app-0.18.0 test/dummy/node_modules/faye-websocket/examples/autobahn_client.js
disco_app-0.18.2 test/dummy/node_modules/faye-websocket/examples/autobahn_client.js
tang-0.2.1 spec/tang_app/node_modules/faye-websocket/examples/autobahn_client.js
tang-0.2.0 spec/tang_app/node_modules/faye-websocket/examples/autobahn_client.js
tang-0.1.0 spec/tang_app/node_modules/faye-websocket/examples/autobahn_client.js
tang-0.0.9 spec/tang_app/node_modules/faye-websocket/examples/autobahn_client.js
enju_library-0.3.8 spec/dummy/node_modules/faye-websocket/examples/autobahn_client.js
ilog-0.4.1 node_modules/faye-websocket/examples/autobahn_client.js
ilog-0.4.0 node_modules/faye-websocket/examples/autobahn_client.js
ilog-0.3.3 node_modules/faye-websocket/examples/autobahn_client.js
jester-data-8.0.0 node_modules/faye-websocket/examples/autobahn_client.js
ezii-os-5.2.1 node_modules/faye-websocket/examples/autobahn_client.js
ezii-os-2.0.1 node_modules/faye-websocket/examples/autobahn_client.js
ezii-os-1.1.0 node_modules/faye-websocket/examples/autobahn_client.js
ezii-os-1.0.0 node_modules/faye-websocket/examples/autobahn_client.js
ezii-os-0.0.0.1.0 node_modules/faye-websocket/examples/autobahn_client.js
ezii-os-0.0.0.0.1 node_modules/faye-websocket/examples/autobahn_client.js
blsk-sevcore-0.0.2 blsk_old/bluesky-doc/bluesky-doc/node_modules/faye-websocket/examples/autobahn_client.js
optimacms-0.4.3 spec/dummy/node_modules/faye-websocket/examples/autobahn_client.js