You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
peter ed3da909c6 push 4 years ago
src doc 4 years ago
test test checkin docs 4 years ago
.drone.yml push 4 years ago
.gitignore automate documentation 4 years ago
.npmignore fix 4 years ago
README.md push 4 years ago
package-lock.json test checkin docs 4 years ago
package.json hide breadcrumbs 4 years ago
tsconfig.json werks 4 years ago

README.md

About

rpclibrary is a websocket on steroids!

How to install

npm i rpclibrary

Quickstart

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]