import { RPCSocketServer } from '../src/backend/RPCSocketServer'
//@ts-ignore
import {RPCSocket} from '../src/frontend/RPCSocket'

new RPCSocketServer(20000, [{
    name: "HelloWorldRPCGroup",
    exportPublicRPCs: () => [],
    exportRPCs: () => [{
        type: 'call',
        name: 'echo',
        func: async (s:string) => s,
    }],
}])

const caller = new RPCSocket(20000, 'localhost')
caller.connect().then(_ => {
    caller.info().then(console.log)
    caller["HelloWorldRPCGroup"].echo("x").then(console.log)
})
