-
-
Notifications
You must be signed in to change notification settings - Fork 20
Home
Samchon edited this page Dec 28, 2018
·
11 revisions
TGrid is a tiny framework for Grid Computing in TypeScript, using such concepts.
- RFC: Remote Function Call
- ROC: Remote Object Call
-
OON: Object Oriented Network
- Promise Pattern (
async
&await
)
- Promise Pattern (
Following paradigm of the TGrid, you can compose real-time network communication systems very easily. Consider that system nodes are correspondent with objects. All you have to do is just calling functions in those objects with a special symbol await
.
I repeat, whether how network systems are enormous and feature are complicated, they're just objects. Just call functions, with the keyword await
. It sound difficult, then look at the below Usage - Example Code, then you may understand. If you want to know more, Guide Documents are prepared for you.
Installing TGrid in NodeJS is very easy. Just install with the npm
command.
# Install TGrid from the NPM module.
npm install --save tgrid
import { Vector } from "tstl/container";
import { WebServer } from "tgrid/protocol/web";
function main(): void
{
let server = new WebServer();
server.open(10101, async acceptor =>
{
await acceptor.accept();
await acceptor.listen(new Vector<number>());
});
}
main();
import { Vector } from "tstl/container";
import { WebConnector } from "tgrid/protocol/web";
async function main(): Promise<void>
{
let connector = new WebConnector();
await connector.connect("ws://127.0.0.1:9999");
await connector.wait();
let v = connector.getDriver<Vector<number>>();
for (let i: number = 0; i < 5; ++i)
await v.push_back(i);
console.log("size:", await v.size());
for (let i: number = 0; i < await v.size(); ++i)
console.log(" element:", await v.at(i));
await connector.close();
}
main();
size: 5 element: 0 element: 1 element: 2 element: 3 element: 4
- Repositories
- Documents
- Related Projects