From ed3da909c6ed336380852cc0a56163c2a38671a4 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 22 Sep 2019 16:57:36 +0200 Subject: [PATCH] push --- README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/README.md b/README.md index 4f48bb3..55e2bbb 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,40 @@ # About +rpclibrary is a websocket on steroids! # How to install +``` +npm i rpclibrary +``` # Quickstart +```typescript +import {Backend, Frontend} from 'rpclibrary' + +const echo = (x) => x + +const server = new Backend.RPCServer(20000, [{ + name: 'HelloWorldRPCGroup', + exportRPCs: () => [ + echo, + function echof(x){ return x }, + { + name: 'echoExplicit', + call: async (x) => x + } + ] +}]) + +const client = new Frontend.RPCSocket(20000, 'localhost') + +client.connect().then(async () => { + const r0 = await client['HelloWorldRPCGroup'].echo('Hello') + const r1 = await client['HelloWorldRPCGroup'].echof('World') + const r2 = await client['HelloWorldRPCGroup'].echoExplicit('RPC!') + + console.log(r0,r1,r2) +}) + +``` # Documentation [https://gitea.frontblock.me/fw-docs/rpclibrary]