1.1.0 • Published 12 months ago

call.io v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Call.IO

npm version License: MIT

A remote procedure call (RPC) module through Socket.IO.

Installation

npm install -s call.io

or :

yarn add call.io

Usage

You can see a use case in /example, here is an example.

Server side

const server = require('http').createServer();
const io     = require('socket.io')(server);
const callio = require('callio');

const methods = {
  log: message => {
    console.log(message);
    return "Hello from server";
  },
  plusOne: value => value + 1
};

io.on('connection', socket => callio.publish(socket, "methods", methods));

server.listen(8080);

Client side

(async () => {

  const socket = require('socket.io-client')('http://127.0.0.1:8080/');
  const callio = require('callio');

  const { log, plusOne } = await callio.require(socket, "methods");

  console.log(await log("Hello from client"));
  console.log(await plusOne(10));

})();

License

Call.IO is released under the MIT License. See LICENSE for more information.

1.1.0

12 months ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago