Giter Club home page Giter Club logo

bsonrpc's Introduction

BSONRPC

A simple rpc server/client based on BSON, written on node.js.

It can work with other languages & systems.

From now on, C++ & Java can simple connect with it.


BSONRPC 模块说明

这是一个简单的RPC 服务端/客户端 模块,采用 BSON 作为其最基本通信包。

本项目作为 Node.js 模块进行编写和发布,同时还有 C++ 和 Java 相关实现。

当然,这个协议是如此 简单 以至于大家都可以简单的编写一个对应语言的模块出来。


Example

To start a project as a RPC service, just do things below:

  1. in your project dir, type npm install bsonrpc to install this module.

  2. create a dir named 'RPC' or something as U wish.

    PS: if you changed the default directory, you need config this when start service.

  3. create a simple model in that dir, such as "Hello, world":

     hello = (session, call_id)->
       session.do_result 
         id: call_id
         result:
           message: "world!"
       
     
     module.exports = (method, session) ->
       return (param, call_id) ->
         hello(session, call_id)
    
  4. create a simple start script:

     rpc = require 'bsonrpc'
     rpc.run 
       host: '127.0.0.1'
       port: 9527
    
  5. all done! A BSON-RPC service is created! Now you can use this service like this:

     client.connect '127.0.0.1', 9527
     
     client.on 'result', (result)->
       log result
     
     client.call 'hello', null, 0
    

备注

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.