Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RSocket routing definition alike tRPC #253

Open
linux-china opened this issue Jan 14, 2023 · 1 comment
Open

RSocket routing definition alike tRPC #253

linux-china opened this issue Jan 14, 2023 · 1 comment

Comments

@linux-china
Copy link
Contributor

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);
      })
});
@viglucci
Copy link
Member

viglucci commented Jan 14, 2023

Given the popularity of tRPC, I've been considering if there are learnings or inspiration we could take away for APIs in rsocket-js.

We have a similar level of support here already with the rsocket-messaging package (example), however rsocket-messaging does not provide the same level of interface (there is small amount of extra work required with rsocket-messaging compared to tRPC).

How important of a consideration is the end-to-end type safety offered by tRPC? I think that would be valuable and interesting for rsocket-js as well, but I'm not sure how that could be approached.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants