GithubHelp home page GithubHelp logo

motebus

MoteBus is a message transport bus for peer-to-peer communication. It supports xMsg, xRPC protocols.

To use this package, it is necessary to acquire the motebus binary file from https://github.com/motebus/motebus/releases

Install

npm install motebus

   

Usage

Add the motebus module to the code

motebus = require('motebus');

The module mainly contains two classes: xRPC and xMsg

xRPC

xrpc = motebus.xRPC();

xRPC contains two functions

The publish function will publish the app which contains your functions on the motebus network.

xrpc.publish("APPNAME","MODULE");
    "APPNAME"             expects a string of the appname being defined in your program
    "MODULE"              expects a string of the function defined inside the appname, multi functions are possible.

The call function will call the function that has been published

xrpc.call("TARGET","FUNCTION","ARGUMENTS","PRIO","TIMEOUT1","TIMEOUT2");
    "TARGET"              expects a string of MMA, which contains "APPNAME"@"IP"
    "FUNCTION"            expects a string as the function name in App
    "ARGUMENT"            expects a list in dictionary format such as {"A":"12","B":"25"}
    "PRIO"                expects an Integer to indicate the priority of the request
    "TIMEOUT1"            expects an Integer to indicate the maximum sending time
    "TIMEOUT2"            expects an Integer to indicate the maximum reply waiting time

 

xMsg

xmsg = motebus.xMsg();

xMsg contains 4 functions

The open function sets the current user as available

xmsg.open("ALIAS","PASSWORD","UNIQUE","CALLBACK");
    "ALIAS"               expects a string of the ID published on the network
    "PASSWORD"            expects a password string, can be left blank
    "UNIQUE"              expects a string of "true" or "false", permission for duplicated ALIAS ID 
    "CALLBACK"            expects a defined function for callback action 

The send function sends the message to the previously defined target

xmsg.send("TARGET","BODY","FILES","PRIO","TIMEOUT1","TIMEOUT2","CALLBACK");
    "TARGET"              expects a string of MMA, which contains "APPNAME"@"IP"
    "BODY"                expects a string of the message
    "FILES"               expects a string of the file path
    "PRIO"                expects an Integer to indicate the priority of the request
    "TIMEOUT1"            expects an Integer to indicate the maximum sending time
    "TIMEOUT2"            expects an Integer to indicate the maximum reply waiting time
    "CALLBACK"            expects a defined function for callback action 

The reply function is used to reply to the received message

xmsg.reply("HEAD","BODY","FILES","PRIO","TIMEOUT1","TIMEOUT2","CALLBACK");
    "HEAD"                expects a string of MMA, which contains "APPNAME"@"IP"
    "BODY"                expects a string of the message
    "FILES"               expects a string of the file path
    "PRIO"                expects an Integer to indicate the priority of request
    "TIMEOUT1"            expects an Integer to indicate the maximum sending time
    "TIMEOUT2"            expects an Integer to indicate the maximum reply waiting time
    "CALLBACK"            expects a defined function for callback action 

The extract function is for saving the file received to the PATH you defined.

xmsg.extract("MESSAGE_ID","PATH","CALLBACK");
    "MESSAGE_ID"          expects a string of the senders DDN
    "PATH"                expects a string of the stored file path
    "CALLBACK"            expects a defined function for callback action 

motebus's Projects

alexnet-pytorch icon alexnet-pytorch

An PyTorch implementation AlexNet.Simple, easy to use and efficient

browserify icon browserify

A full-featured Browserify + vueify setup with hot-reload, linting & unit testing.

electron icon electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

motebus icon motebus

MoteBus is a message transport bus for peer-to-peer communication. It supports xMsg, xRPC protocols.

motechat icon motechat

MoteChat is an end-to-end microservices message. It supports xRPC and xMsg communication

motechat-hello icon motechat-hello

An echo service created by YPCloud that allows users to hold the ability to respond to incoming calls.

node_acl icon node_acl

Access control lists for node applications

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.