import { RPCSocket } from '../src/Frontend' const client = new RPCSocket(20000, 'localhost') client.connect().then(async _ => { await client.info().then(console.log) await client["HelloWorldRPCGroup"].echo("x") .then(hopefullyX => console.log("echo('x') returned x: ", hopefullyX === "x", hopefullyX)) await client["HelloWorldRPCGroup"].add(1,2,3) .then(hopefully6 => console.log("add(1,2,3) returned 6: ", hopefully6 === 6, hopefully6)) let counter = 0 const handler = (s) => { counter++ if(counter === 3) console.log("subscribe call counter met", counter === 3) } await client["HelloWorldRPCGroup"].subscribe(handler) await Promise.all([ client["HelloWorldRPCGroup"].triggerCallback("test1", "test1", "test1", ), client["HelloWorldRPCGroup"].triggerCallback("test2", "test2", "test2", ), client["HelloWorldRPCGroup"].triggerCallback("test3", "test3", "test3", ), ]) counter = 0 const simplehandler = (s) => { counter++ if(counter === 3) console.log("simpleSubscribe call counter met", counter === 3) } await client["HelloWorldRPCGroup"].simpleSubscribe(simplehandler) client["HelloWorldRPCGroup"].triggerCallback("simple1", "simple1", "simple1", ) client["HelloWorldRPCGroup"].triggerCallback("simple2", "simple2", "simple2", ) client["HelloWorldRPCGroup"].triggerCallback("simple3", "simple3", "simple3", ) })