Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arturo-client

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arturo-client - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

35

lib/Client.js

@@ -7,2 +7,6 @@ 'use strict';

var _debug = require('debug');
var _debug2 = _interopRequireDefault(_debug);
var _nssocket = require('nssocket');

@@ -14,8 +18,12 @@

let id = 0;
class Client {
constructor(opts) {
this._opts = Object.assign({
port: 61818
port: 61681
}, opts);
this.uuid = `${this.constructor.name}-${process.pid}-${id++}`;
this.debug = (0, _debug2.default)(`arturo:${this.uuid}`);
this._connection = null;

@@ -30,4 +38,7 @@ }

connection.on('close', err => err && reject(err));
connection.on('timeout', () => client.close());
connection.data(['connected'], () => resolve());
connection.on('timeout', () => connection.close());
connection.data(['connected'], () => {
this.debug('connected');
resolve(connection);
});
connection.connect(this._opts.port);

@@ -41,2 +52,3 @@ });

async _transmit(method, data) {
const self = this;
const workers = Client.toArray(data);

@@ -48,5 +60,6 @@ const connection = await this.connection();

const successEvent = ['worker', method, 'success'];
client.on(successEvent, function onSuccess(result) {
if (result.id !== worker.id) return;
client.removeListener(successEvent, onSuccess);
connection.data(successEvent, function onSuccess(result) {
if (result.route !== worker.route) return;
self.debug(`create worker ${result.route} success!`);
connection.removeListener(successEvent, onSuccess);
resolve();

@@ -56,9 +69,11 @@ });

const errorEvent = ['worker', method, 'error'];
client.on(errorEvent, function onError(result) {
if (result.id !== worker.id) return;
client.removeListener(errorEvent, onError);
connection.data(errorEvent, function onError(result) {
if (result.route !== worker.route) return;
self.debug(`create worker ${result.route} error.`);
connection.removeListener(errorEvent, onError);
reject();
});
client.send(['worker', method], worker);
this.debug(`create worker ${worker.route}`);
connection.send(['worker', method], worker);
}).catch(err => console.error(err)));

@@ -65,0 +80,0 @@

{
"name": "arturo-client",
"version": "1.0.5",
"version": "1.0.6",
"main": "lib/Client.js",

@@ -5,0 +5,0 @@ "author": "chad.d.elliott@gmail.com",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc