您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

test.ts 469B

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