Coder Social home page Coder Social logo

geraked / js-rmi Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 741 KB

Implementation of RMI in Node.js

License: MIT License

JavaScript 100.00%
rmi remote-method-invocation rpc middleware js-rmi nodejs node-js javascript es6 rabist geraked amirkabir-university distributed-systems computer-science library js-library computer-engineering

js-rmi's Introduction

RMI

Implementation of RMI in Node.js

Run the example

  • Make sure Node.js has been installed on your machine.
  • Download the repository as ZIP or use the following command:
git clone https://github.com/geraked/js-rmi.git
  • Go to directory where the file package.json exists:
cd js-rmi
  • Execute the following command to run the example:
npm run example

Use the library

  • Install:
npm i https://github.com/geraked/js-rmi.git
  • Define an abstract class (interface) and share between the client and server:

IHuman.js

  • Implement the interface on the server:

Human.js

  • Create an object on the server and bind it:
import { ServerStub } from "rmi";
import { Human } from "./Human.js";

let stub = new ServerStub("localhost", 3000);
let human = new Human("Amir", 17, 67, 1.73);

stub.bind("/human", human);
  • Lookup the remote object from the client and use it:
import { IHuman } from "../shared/IHuman.js";
import { ClientStub } from "rmi";

let stub = new ClientStub("localhost", 3000);
let human = stub.lookup("/human", IHuman);

console.log("toJSON:", await human.toJSON());
console.log("BMI:", await human.bmi());

// Manipulate
await (human.name = "Reza");
await (human.height = 1.8);
await (human.age = (await human.age) + 3);
await human.looseWeight(5);

Author

Rabist - view on LinkedIn

Details

  • Course: Distributed Systems - MS
  • Teacher: Dr. Amir Kalbasi
  • Univ: Amirkabir University of Technology - Tehran Polytechnic
  • Semester: Fall 1400

The exercise and report documents are available in docs branch.

View the Exercise PDF.

View the Report PDF.

License

Licensed under MIT.

js-rmi's People

Contributors

geraked avatar

Watchers

 avatar  avatar  avatar

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.