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

Feature: RxJS based tRPC client #379

Closed
1 of 2 tasks
Dafnik opened this issue May 9, 2023 · 4 comments
Closed
1 of 2 tasks

Feature: RxJS based tRPC client #379

Dafnik opened this issue May 9, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Dafnik
Copy link
Contributor

Dafnik commented May 9, 2023

Which scope/s are relevant/related to the feature request?

trpc

Information

Add a RxJS compatible trpc-client to analogjs.

I would like to contribute the functionality of ngx-trpc to Analog's trpc implementation.

@goetzrobin pointed out on reddit [thread] that it would be a good fit and I also think that you would get the most benefit out of ngx-trpc by using it in a meta framework like Analog.

Before starting with the implementation I would like get feedback on a few things.

  1. tRPC client websocket subscribe
    trpc-client subscribe method for subscribing to websockets is currently not supported. Would this be required?

  2. some bugs to fix
    I still get some warning running the custom trpc client and would like to ask you if you have any ideas fixing this.
    Here is an startet example with the error. https://github.com/Dafnik/ngx-trpc-nx-fastify-example

When all questions are cleared I can start creating a pull request.

If you have any other thoughts or questions just hit me up.

Cheers!

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Cross-referencing: #197

@Dafnik Dafnik added the enhancement New feature or request label May 9, 2023
@goetzrobin
Copy link
Member

Right now it relies on a hard coded httpBatchLink, so no web socket support is definitely not a blocker.

In regards to the bugs, I would suggest to create a branch with the implementation and we can work through them during the code review process? That way we already have the code in the analog context and within the repository, which should make it a little easier to debug.

That's what I am thinking at least! @brandonroberts what do you think?

@brandonroberts
Copy link
Member

Cool project! That sounds good to me. We should consider support/integration for Angular Signals also for the future.

@goetzrobin
Copy link
Member

Thats a really good point! I would love something like the react hooks DX provided by tRPC directly. Maybe something like the suspensify method described in this article would be cool? https://marmicode.io/blog/managing-rxjs-traffic-with-signals

@Dafnik
Copy link
Contributor Author

Dafnik commented May 10, 2023

Sounds good to me @goetzrobin. I will start implementing a pr.

yeah. good point @brandonroberts. This would probably be a second client.

suspensify looks great, but do we want this in both, the rxjs and signal client?

Villanuevand pushed a commit to Villanuevand/analog that referenced this issue Sep 12, 2023
This commit introduces a rxjs version of the tRPC client. Instead of returning a Promise, the client now
returns observables for all operations. Therefore it behaves similar to the built in Angular HttpClient.

closes analogjs#379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants