
Security News
TypeScript is Porting Its Compiler to Go for 10x Faster Builds
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
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 1 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
TypeScript is porting its compiler to Go, delivering 10x faster builds, lower memory usage, and improved editor performance for a smoother developer experience.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.