1.5.1 • Published 4 years ago

ezrpc v1.5.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

ezrpc

Easy to use RPC server/client (+ load balancer)

CI Inline docs Coverage Status

// server.js
const { Server } = require('ezrpc')
const server = new Server(1250) // run rpc server on port 1250

function helloWorld () {
  console.log('Hello World!')
}

// Make helloWorld accessible by the remote client
server.module.exports = {
  helloWorld
}
// client.js
const { Client } = require('ezrpc')
const { helloWorld } = new Client('localhost', 1250).methods

helloWorld()
  .then(() => console.log('helloWorld() was called on server process'))

Installing

$ npm install ezrpc

$ yarn add ezrpc

Why?

  • Easily load-balance tasks among multiple processes on multiple machines
  • Can be used like a child process, but does not have to be spawned on every function call
  • ezrpc servers can be used in almost any language

Docs

The wiki will help you get started with ezrpc

Additionally you can generate html documentation of all all method & properties using jsdoc using the doc script:

$ npm run doc

$ yarn doc

Documentation will appear in /jsdoc

Tests

Tests are not included when you download from npm; clone the GitHub repository to run tests.

npm

$ npm install
$ npm test

yarn

$ yarn install
$ yarn test

Examples

Some basic explanatory examples can be found here. They currently include a simple master-child example where the master (client.js) calls methods on the child process (server.js), and an example where the LoadBalancer class is used to distribute calls among multiple servers.

1.5.1

4 years ago

1.5.0

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago