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

nats

Package Overview
Dependencies
Maintainers
1
Versions
195
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nats - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

.travis.yml

24

lib/nats.js

@@ -21,3 +21,3 @@ /*!

var VERSION = '0.2.0',
var VERSION = '0.2.1',

@@ -244,3 +244,3 @@ DEFAULT_PORT = 4222,

client.emit('disconnect');
if (client.options.reconnect === false ||
if (client.closed === true || client.options.reconnect === false ||
client.reconnects >= client.options.maxReconnectAttempts) {

@@ -255,2 +255,3 @@ client.emit('close');

client.closeStream();
if (client.reconnecting === false) {

@@ -262,6 +263,6 @@ client.emit('error', exception);

if (client.reconnecting === true) {
if (client.reconnects < client.options.maxReconnectAttempts) {
if (client.closed === true || client.reconnects >= client.options.maxReconnectAttempts) {
client.emit('close');
} else {
client.scheduleReconnect();
} else {
client.emit('close');
}

@@ -356,9 +357,10 @@ }

Client.prototype.close = function() {
this.removeAllListeners();
this.closeStream();
this.closed = true;
this.ssid = -1;
this.subs = null;
this.pstate = -1;
this.pongs = null;
this.pending = null;
this.closed = true;
this.ssid = -1;
this.subs = null;
this.pstate = -1;
this.pongs = null;
this.pending = null;
}

@@ -365,0 +367,0 @@

{
"name": "nats",
"description": "Node.js client for NATS, a lightweight messaging system",
"version": "0.2.0",
"version": "0.2.1",
"repository": {

@@ -6,0 +6,0 @@ "type" : "git",

# Node_Nats
A Node.js client for NATS.
A Node.js client for the [NATS messaging system](https://github.com/derekcollison/nats).
[![Build Status](https://secure.travis-ci.org/derekcollison/node_nats.png)](http://travis-ci.org/derekcollison/node_nats)
## Installation

@@ -6,0 +8,0 @@

@@ -28,2 +28,3 @@ var NATS = require ('../'),

/Authorization/.exec(err).should.exist;
nc.close();
done();

@@ -30,0 +31,0 @@ });

@@ -19,3 +19,3 @@ var NATS = require ('../'),

it('should do basic subscribe and unsubscribe', function() {
it('should do basic subscribe and unsubscribe', function(done) {
var nc = NATS.connect(PORT);

@@ -25,9 +25,15 @@ var sid = nc.subscribe('foo');

nc.unsubscribe(sid);
nc.close();
nc.flush(function() {
nc.close();
done();
});
});
it('should do basic publish', function() {
it('should do basic publish', function(done) {
var nc = NATS.connect(PORT);
nc.publish('foo');
nc.close();
nc.flush(function() {
nc.close();
done();
});
});

@@ -34,0 +40,0 @@

@@ -49,3 +49,3 @@ var NATS = require ('../'),

var elapsed = new Date() - startTime;
elapsed.should.be.within(WAIT, 2*WAIT);
elapsed.should.be.within(WAIT, 5*WAIT);
nc.close();

@@ -56,7 +56,4 @@ server = nsc.start_server(PORT, done);

var elapsed = new Date() - startTime;
elapsed.should.be.within(0, 100);
elapsed.should.be.within(0, 5*WAIT);
});
nc.on('close', function() {
done(new Error('Close event improperly called'));
});
});

@@ -74,3 +71,3 @@

var elapsed = new Date() - startTime;
elapsed.should.be.within(WAIT, 2*WAIT);
elapsed.should.be.within(WAIT, 5*WAIT);
startTime = new Date();

@@ -77,0 +74,0 @@ numAttempts += 1;

@@ -27,3 +27,3 @@

var maxWait = 5 * 1000; // 5 secs
var delta = 250;
var delta = 50;
var socket;

@@ -70,3 +70,3 @@ var timer;

socket.on('error', function(error) {
finish(new Error("Error connecting to server on port: " + port));
// finish(new Error("Problem connecting to server on port: " + port + " (" + error + ")"));
});

@@ -73,0 +73,0 @@

Sorry, the diff of this file is not supported yet

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