fingerprint-container-node-sdk
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -14,7 +14,13 @@ var util = require('util'); | ||
Client.prototype.rpcRequest = function (serviceName, body, callback, timeout) { | ||
Client.prototype.rpcRequest = function (serviceName, body, success, error, timeout) { | ||
var _me = this; | ||
var msg = this._genMsg(serviceName, {flag: FLAG.RPC}); | ||
var hasErrorFn = typeof error == "function"; | ||
Service.prototype.rpcRequest.call(this, body, msg); | ||
if (!hasErrorFn) { | ||
timeout = error; | ||
error = null; | ||
} | ||
var timer = setTimeout(function () { | ||
@@ -24,3 +30,4 @@ var askId = msg.askId; | ||
_me.rpcs.splice(rpcInfo.index, 1); | ||
_me.emit('timeout', { | ||
hasErrorFn && error({ | ||
error: "timeout", | ||
serviceName: serviceName, | ||
@@ -34,3 +41,3 @@ body: body, | ||
askId: msg.askId, | ||
callback: callback, | ||
callback: success, | ||
timer: timer, | ||
@@ -37,0 +44,0 @@ index: this.rpcs.length |
{ | ||
"name": "fingerprint-container-node-sdk", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "fingerprint container's sdk", | ||
@@ -5,0 +5,0 @@ "main": "fpc.js", |
@@ -59,5 +59,7 @@ FPC NODE SDK | ||
console.log(body); | ||
}, 2000); | ||
}, function(){ | ||
console.log("timeout"); | ||
},2000); | ||
}); | ||
``` | ||
@@ -6,3 +6,3 @@ var assert = require('assert'); | ||
var SERVICE_HOST = '172.16.50.46'; | ||
var SERVICE_HOST = '172.16.90.42'; | ||
var SERVICE_PORT = 9900; | ||
@@ -116,9 +116,7 @@ | ||
name: serviceName | ||
}); | ||
setTimeout(function () { | ||
if (!client.rpcs.length) { | ||
done(); | ||
} | ||
}, 4000); | ||
}, function () { | ||
}, function () { | ||
done(); | ||
}, 2000); | ||
}); | ||
@@ -125,0 +123,0 @@ }); |
@@ -5,3 +5,3 @@ var assert = require('assert'); | ||
var SERVICE_HOST = '172.16.50.46'; | ||
var SERVICE_HOST = '172.16.90.42'; | ||
var SERVICE_PORT = 9900; | ||
@@ -8,0 +8,0 @@ |
Sorry, the diff of this file is not supported yet
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
31266
741
65