rsocket-js icon indicating copy to clipboard operation
rsocket-js copied to clipboard

RSocket routing definition alike tRPC

Open linux-china opened this issue 2 years ago • 1 comments

Routing is built by RSocket by default. https://github.com/rsocket/rsocket/blob/master/Extensions/Routing.md

Is it possible to define RSocket router alike tRPC? It's really easy for client and server sides.

const helloRouter = router({
    hello: t.procedure
        .input(
            z.object({
                name: z.string(),
            }),
        )
        .request(({input}) => `hello ${input.name}` ),
    hello2: publicProcedure
        .input(z.string())
        .fire(({input}) => {
          console.log(input);
      })
});

linux-china avatar Jan 14 '23 13:01 linux-china