Skip to content

TCP adapter #5995

Open
Open

Description

@valerii15298

Describe the feature you'd like to request

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!

Activity

  1. KATT commented on Sep 20, 2024

    @KATT
    Member

    Feel ree to have a stab at it, the core team won't work on this in the foreseeable future

  2. valerii15298 commented on Sep 21, 2024

    @valerii15298
    Author

    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

  3. maddsua commented on Nov 27, 2024

    @maddsua
    Contributor

    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?

  4. KATT commented on Nov 2, 2026

    @KATT
    Member

    🤖 v12 has raw TCP support (experimental): experimental_serveSocket on the server and experimental_socketLink on the client. https://v12.trpc.io/v12/docs/adapters/sockets. v12 isn't released yet and there's no ETA.

  5. added
    next-major/maybe
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    next-major/maybe

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions