TGrid
TypeScript Grid Computing Framework.
TypeScript RPC (Remote Procedure Call) framework for WebSocket
and Worker
protocols.
WebSocket
Worker
SharedWorker
NestJS
Also, easy to develop complicated network system like grid computing.
import { Driver, WebSocketConnector } from "tgrid";
export const webSocketClientMain = async () => {
const connector: WebSocketConnector<null, null, ICalculator> =
new WebSocketConnector(
null,
null,
);
await connector.connect("ws://127.0.0.1:37000/composite");
const remote: Driver<ICalculator> = connector.getDriver();
console.log(
await remote.plus(10, 20),
await remote.minus(7, 3),
await remote.multiply(3, 4),
await remote.divide(5, 2),
);
await connector.close();
};
interface ICalculator {
plus(a: number, b: number): number
minus(a: number, b: number): number
multiply(a: number, b: number): number
divide(a: number, b: number): number
}
$ npm start
30 4 12 2.5
Setup
npm install tgrid
Just install with npm
command. That's all.
If you wanna use TGrid
in NestJS
, read Nestia
guide documents, too.
Playground
You can quickly experience TGrid
on the playground websites:
Guide Documents
Check out the document in the website:
🏠 Home
📖 Tutorial
- Features
- Learn from Examples
- Learn from Projects
🔗 Appendix