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

fingerprint-container-node-sdk

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fingerprint-container-node-sdk

fingerprint container's sdk

  • 0.1.6
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

FPC NODE SDK

Run Unit Test

npm install && npm test

Server API

    var FPC = require('finerprint-container-node-sdk');
    var server = new FPC.Server('127.0.0.1','9090');
    
    // 增加一个rpc handler
    server.addHandler('ServiceName',function(res){
        //回复调用的client
        res.send({
            words: "hello world!"
        });
    });
    
    // 监听connect事件
    server.on('connect',function(){
        // connect成功后进行服务注册
        server.register();
    });
       
    // 注册成功回调
    server.on('register',function(){
        console.log('register success');
    });

Client API

    var FPC = require('finerprint-container-node-sdk');
    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);
        }, function(){
            console.log("timeout");
        },2000);
    });

Keywords

FAQs

Package last updated on 09 Dec 2016

Did you know?

Socket

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.

Install

Related posts

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