socketcluster-client
Advanced tools
Comparing version 9.0.0 to 9.0.1
{ | ||
"name": "socketcluster-client", | ||
"main": "socketcluster.js", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"homepage": "https://github.com/SocketCluster/socketcluster-client", | ||
@@ -6,0 +6,0 @@ "description": "SocketCluster JavaScript client", |
@@ -19,2 +19,2 @@ var SCSocket = require('./lib/scsocket'); | ||
module.exports.version = '9.0.0'; | ||
module.exports.version = '9.0.1'; |
@@ -578,2 +578,6 @@ var Emitter = require('component-emitter'); | ||
} | ||
// Cleanup any pending response callback in the transport layer too. | ||
if (eventObject.cid) { | ||
this.transport.cancelPendingResponse(eventObject.cid); | ||
} | ||
} | ||
@@ -681,2 +685,6 @@ }; | ||
} | ||
// Cleanup any pending response callback in the transport layer too. | ||
if (eventObject.cid) { | ||
this.transport.cancelPendingResponse(eventObject.cid); | ||
} | ||
}; | ||
@@ -683,0 +691,0 @@ |
@@ -314,3 +314,2 @@ var Emitter = require('component-emitter'); | ||
SCTransport.prototype._handleEventAckTimeout = function (eventObject) { | ||
if (eventObject.cid) { | ||
@@ -317,0 +316,0 @@ delete this._callbackMap[eventObject.cid]; |
{ | ||
"name": "socketcluster-client", | ||
"description": "SocketCluster JavaScript client", | ||
"version": "9.0.0", | ||
"version": "9.0.1", | ||
"homepage": "http://socketcluster.io", | ||
@@ -50,3 +50,3 @@ "contributors": [ | ||
"mocha": "3.0.2", | ||
"socketcluster-server": "^6.3.0", | ||
"socketcluster-server": "^9.1.1", | ||
"uglify-js": "^2.7.5", | ||
@@ -53,0 +53,0 @@ "vinyl-source-stream": "^1.1.0" |
@@ -14,7 +14,9 @@ var assert = require('assert'); | ||
port: PORT, | ||
multiplex: false | ||
multiplex: false, | ||
ackTimeout: 200 | ||
}; | ||
var serverOptions = { | ||
authKey: 'testkey' | ||
authKey: 'testkey', | ||
ackTimeout: 200 | ||
}; | ||
@@ -52,2 +54,7 @@ | ||
}); | ||
socket.on('performTask', function (action, respond) { | ||
setTimeout(function () { | ||
respond(); | ||
}, 1000); | ||
}); | ||
}; | ||
@@ -568,3 +575,3 @@ | ||
it('should trigger the close event if the socket disconnects in the after the handshake phase', function (done) { | ||
it('should trigger the close event if the socket disconnects after the handshake phase', function (done) { | ||
client = socketClusterClient.connect(clientOptions); | ||
@@ -597,2 +604,36 @@ var aborted = false; | ||
}); | ||
describe('emitting events', function () { | ||
it('should not throw error on socket if ackTimeout elapses before response to event is sent back', function (done) { | ||
client = socketClusterClient.connect(clientOptions); | ||
var caughtError; | ||
var clientError; | ||
client.on('error', function (err) { | ||
clientError = err; | ||
}); | ||
var responseError; | ||
client.on('connect', function () { | ||
client.emit('performTask', 123, function (err) { | ||
responseError = err; | ||
}); | ||
setTimeout(function () { | ||
try { | ||
client.disconnect(); | ||
} catch (e) { | ||
caughtError = e; | ||
} | ||
}, 250); | ||
}); | ||
setTimeout(function () { | ||
assert.notEqual(responseError, null); | ||
assert.equal(caughtError, null); | ||
done(); | ||
}, 300); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
296120
6888