https://github.com/geraked/js-rmi
Implementation of RMI in Node.js
https://github.com/geraked/js-rmi
amirkabir-university computer-engineering computer-science distributed-systems es6 geraked javascript js-library js-rmi library middleware node-js nodejs rabist remote-method-invocation rmi rpc
Last synced: 12 months ago
JSON representation
Implementation of RMI in Node.js
- Host: GitHub
- URL: https://github.com/geraked/js-rmi
- Owner: geraked
- License: mit
- Created: 2021-12-20T17:54:16.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-12-23T04:50:43.000Z (about 4 years ago)
- Last Synced: 2025-01-03T14:50:31.888Z (about 1 year ago)
- Topics: amirkabir-university, computer-engineering, computer-science, distributed-systems, es6, geraked, javascript, js-library, js-rmi, library, middleware, node-js, nodejs, rabist, remote-method-invocation, rmi, rpc
- Language: JavaScript
- Homepage:
- Size: 724 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# RMI
Implementation of RMI in Node.js
## Run the example
- Make sure [Node.js](https://nodejs.org/en/download/) has been installed on your machine.
- Download the repository as [ZIP](https://github.com/geraked/js-rmi/archive/refs/heads/master.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](example/shared/IHuman.js)
- Implement the interface on the server:
[Human.js](example/server/Human.js)
- Create an object on the `server` and bind it:
```js
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:
```js
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](https://www.linkedin.com/in/rabist)
## Details
- **Course:** Distributed Systems - MS
- **Teacher:** [Dr. Amir Kalbasi](https://aut.ac.ir/cv/2241/AMIR-KALBASI?slc_lang=en)
- **Univ:** Amirkabir University of Technology - Tehran Polytechnic
- **Semester:** Fall 1400
The exercise and report documents are available in [`docs`](https://github.com/geraked/js-rmi/tree/docs) branch.
View the [Exercise PDF](https://github.com/geraked/js-rmi/blob/docs/exercise.pdf).
View the [Report PDF](https://github.com/geraked/js-rmi/blob/docs/report.pdf).
## License
Licensed under [MIT](LICENSE).