v 1.2.4 minor README changes

This commit is contained in:
peter
2019-09-25 21:14:31 +02:00
parent 6756c98beb
commit b9a8f06ec4
2 changed files with 8 additions and 8 deletions
+7 -7
View File
@@ -12,7 +12,7 @@ import {Backend, Frontend} from 'rpclibrary'
const echo = (x) => x
const server = new Backend.RPCServer(20000, [{
const server = new Backend.RPCServer(port, [{
name: 'HelloWorldRPCGroup',
exportRPCs: () => [
echo, //named function variable
@@ -24,7 +24,7 @@ const server = new Backend.RPCServer(20000, [{
]
}])
const client = new Frontend.RPCSocket(20000, 'localhost')
const client = new Frontend.RPCSocket(port, host)
client.connect().then(async () => {
const r0 = await client['HelloWorldRPCGroup'].echo('Hello')
@@ -51,7 +51,7 @@ import {Backend, Frontend, Utils} from 'rpclibrary'
const callbacks:Map<string, Function> = new Map()
const server = new Backend.RPCServer(20000, [{
const server = new Backend.RPCServer(port, [{
name: 'HelloWorldRPCGroup',
exportRPCs: () => [
function triggerCallbacks(...messages){ callbacks.forEach(cb => cb.apply({}, messages)) },
@@ -69,7 +69,7 @@ const server = new Backend.RPCServer(20000, [{
]
}])
const client = new Frontend.RPCSocket(20000, 'localhost')
const client = new Frontend.RPCSocket(port, host)
client.connect().then(async () => {
const res = await client['HelloWorldRPCGroup'].subscribe(async (...args:any) => {
console.log.apply(console, args)
@@ -86,7 +86,7 @@ client.connect().then(async () => {
If you need to include further response data into your `SubscriptionResponse` you can extend it using the server's first generic parameter `SubResType`
```typescript
new RPCServer<{extension: string}>({
new RPCServer<{extension: string}>(port, {
name: 'MyRPCGroup',
exportRPCs: () => [{
name: 'subscribe',
@@ -126,7 +126,7 @@ RPCSocket.makeSocket<MyInterface>(port, host).then((async (client) => {
/* OR */
const client = new Frontend.RPCSocket(20000, 'localhost')
const client = new Frontend.RPCSocket(port, host)
client.connect<MyInterface>().then((async (client) => {
const r = await client.Group2.echo("hee") //tsc knows about available RPCs
}))
@@ -134,7 +134,7 @@ client.connect<MyInterface>().then((async (client) => {
Create a server using
```typescript
new RPCServer<{a:string}, MyInterface>(20001,
new RPCServer<{a:string}, MyInterface>(port,
[{
//...
},{
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "rpclibrary",
"version": "1.2.3",
"version": "1.2.4",
"description": "rpclibrary is a websocket on steroids!",
"main": "./js/Index.js",
"repository": {