Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
fingerprint-container-node-sdk2
Advanced tools
npm install && npm test
var FPC = require('fingerprint-container-node-sdk2');
var server = new FPC.Server('127.0.0.1','9090');
// 增加一个rpc handler
server.addHandler('ServiceName',function(res){
//回复调用的client
res.send({
words: "hello world!"
});
server.destroy();
});
// 监听connect事件
server.on('connect',function(){
// connect成功后进行服务注册
server.register();
});
// 注册成功回调
server.on('register',function(){
console.log('register success');
});
var FPC = require('fingerprint-container-node-sdk2');
var client = new FPC.Client('127.0.0.1','9090');
// 监听connect事件
client.on('connect',function(){
// connect成功后进行服务注册
client.register();
});
// 注册成功回调
client.on('register',function(){
// 发送一个event事件给容器
client.eventRequest('ServiceName', {
name: 'event'
});
// 发送一个rpc给容器,timeout=2s, 等待server回复
client.rpcRequest('ServiceName',{
name: 'rpc'
},function(body){
console.log(body);
client.destroy(); // 销毁client
}, function(){
console.log("timeout");
},2000);
});
#ClientPool API
var FPC = require('fingerprint-container-node-sdk2');
var pool = new FPC.ClientPool({
host: '127.0.0.1',
port: 8080,
num: 5, // 启动多少client,默认为5
name: 'mis', // Server名
heartbeat: 30*1000 // 心跳检测轮询时间,用来剔除失活的链接
});
pool.acquire(function(client){
client.rpcRequest('ServiceName',{
name: 'rpc'
},function(body){
pool.release(client);
console.log(body);
}, function(){
pool.release(client);
console.log("timeout");
},2000);
});
FAQs
fingerprint container's sdk
The npm package fingerprint-container-node-sdk2 receives a total of 7 weekly downloads. As such, fingerprint-container-node-sdk2 popularity was classified as not popular.
We found that fingerprint-container-node-sdk2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.