You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add raw TCP adapter. tRPC shines in context of http servers, but there is no ability to use it with raw TCP.
This feature would allow to use tRPC with microservices written in typescript.
Describe the solution you'd like to see
For http adapters tRPC router receives all data from http post body or get query params. With tcp I believe there could be just raw json body without http overhead.
Describe alternate solutions
I do not see any alternatives for now, except just not using trpc.
Additional information
No response
👨👧👦 Contributing
🙋♂️ Yes, I'd be down to file a PR implementing this feature!
The tricky part was to find the right methods on trpc internal api. Would you be able to check it out and share your thoughts on it please? I will be extremely glad if you can give any advice or direction for this feature @KATT
I somehow could figure out how to do all tcp related stuff, but unsure what should I use in trpc internal api...
Also I checked existing adapters for server and client, but they are just way too complicated for me to understand yet, I surrendered when checked resolveResponse on backend and wsLink on frontend.
To make correct adapter would take me quite a while, but it is quite interesting stuff. If I will figure out how to make adapters in the right way I will file a PR. And for now I was not able to find any docs about how to make a custom adapter
Wow I wasn't expecting a feature request like that in a javascript project.
Lemme ask you, what kind of microservices are we talking about, for which http is considered to be an overhead?
Activity
KATT commentedon Sep 20, 2024
Feel ree to have a stab at it, the core team won't work on this in the foreseeable future
valerii15298 commentedon Sep 21, 2024
I tried to implement just simplest possible proof of concept here: https://github.com/valerii15298/trpc-tcp-example
It is as basic as possible and far from perfect but works with simple query methods.
The tricky part was to find the right methods on trpc internal api. Would you be able to check it out and share your thoughts on it please? I will be extremely glad if you can give any advice or direction for this feature @KATT
I somehow could figure out how to do all tcp related stuff, but unsure what should I use in trpc internal api...
Also I checked existing adapters for server and client, but they are just way too complicated for me to understand yet, I surrendered when checked resolveResponse on backend and wsLink on frontend.
To make correct adapter would take me quite a while, but it is quite interesting stuff. If I will figure out how to make adapters in the right way I will file a PR. And for now I was not able to find any docs about how to make a custom adapter
maddsua commentedon Nov 27, 2024
Wow I wasn't expecting a feature request like that in a javascript project.
Lemme ask you, what kind of microservices are we talking about, for which http is considered to be an overhead?
KATT commentedon Nov 2, 2026
🤖 v12 has raw TCP support (experimental):
experimental_serveSocketon the server andexperimental_socketLinkon the client. https://v12.trpc.io/v12/docs/adapters/sockets. v12 isn't released yet and there's no ETA.