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.

test.ts 517B

12345678910111213141516171819
  1. import { RPCSocketServer } from '../src/backend/RPCSocketServer'
  2. //@ts-ignore
  3. import {RPCaller} from '../src/frontend/RPCaller'
  4. new RPCSocketServer(20000, [{
  5. name: "HelloWorldRPCGroup",
  6. exportRPCs: () => [{
  7. type: 'call',
  8. name: 'echo',
  9. func: async (s:string) => s,
  10. visibility: 'private'
  11. }]
  12. }] )
  13. const caller = new RPCaller(20000, 'localhost')
  14. caller.connect().then(_ => {
  15. caller.info().then(console.log)
  16. caller["HelloWorldRPCGroup"].echo("x").then(console.log)
  17. })