Skip to content

feat: client subscriber gets an AsyncIterable #6868

Closed

Description

@hugo082

Describe the feature you'd like to request

On the vanilla client, being able to an AsyncIterable<T> from a subscription in order to make it compliant with the streamedQuery from tansatck query.

Currently @trpc/tanstack-react-query support for useSubscriptions but implementing the AsyncIterable on the vanilla client would provide the feature to vue user as well.

Describe the solution you'd like to see

Implement the client.myProcedure.subscribe().iterator(): Promise<AsyncIterable<T>>

Describe alternate solutions

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing this feature!

Activity

  1. zackdotcomputer commented on Sep 10, 2025

    @zackdotcomputer

    Seconding either this and/or returning the node-basic ReadableStream - running into this dealing with the Vercel ai sdk, which expects more standard streaming objects.

  2. added
    ✅ accepted-PRs-welcome
    on Sep 10, 2025
  3. hugo082 commented on Sep 25, 2025

    @hugo082
    Author

    What about providing the following API?

    client.myProcedure.subscribe(): Unsubscribable // deprecated
    client.myProcedure.observe(): Unsubscribable   // new one - exact same behavior
    client.myProcedure.iterate(): AsyncIterable<T>
    client.myProcedure.stream(): ReadableStream
    

    Currently the server package defines the following internal helpers:

  4. evolvomind commented on Feb 19, 2026

    @evolvomind
    Contributor

    Hi, @KATT
    May I work on this issue?

  5. tarikermis commented on Aug 9, 2026

    @tarikermis
    Contributor

    Hi! Taking this over since there hasn't been movement for a while. I'll implement an AsyncIterable API for the vanilla client subscriber (building on the existing observableToAsyncIterable helper) and open a PR.

  6. KATT commented on Nov 2, 2026

    @KATT
    Member

    🤖 In v12, the vanilla client's subscribe() returns an AsyncIterable, so you can write for await (const post of client.onPost.subscribe()) { … } or hand it to anything that takes one, such as TanStack's streamedQuery. https://v12.trpc.io/v12/docs/subscriptions/overview. v12 isn't released yet and there's no ETA.

  7. added
    next-major/definite
    on Nov 2, 2026
  8. added a commit that references this issue on Nov 4, 2026
    b910b45
  9. github-actions commented on Nov 6, 2026

    @github-actions
    Contributor

    This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.

  10. locked as resolved and limited conversation to collaborators on Nov 6, 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/definite✅ accepted-PRs-welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions