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

Signalr typescript client provide stream to AsyncGenerator in additional to IStreamResult<T> #47840

Open
1 task done
sdcb opened this issue Apr 23, 2023 · 0 comments
Open
1 task done
Labels
area-signalr Includes: SignalR clients and servers

Comments

@sdcb
Copy link

sdcb commented Apr 23, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am trying to use signalr client, but found that it returns AsyncGenerator, which not very easy to use in modern APIs like for await:

class HubConnection {
  stream<T = any>(methodName: string, ...args: any[]): IStreamResult<T>;
}

Describe the solution you'd like

A new api that returns AsyncGenerator:

HubConnection {
  stream<T = any>(methodName: string, ...args: any[]): IStreamResult<T>;
  streamAsync<T = any>(methodName: string, ...args: any[]): AsyncGenerator<T>;
}

so I can using for await to execute this streamAsync result:

for await (const c of hubConnection.streamAsync(this.userInput)) {
  resp.content += c;
}

Additional context

No response

@dotnet-issue-labeler dotnet-issue-labeler bot added the area-signalr Includes: SignalR clients and servers label Apr 23, 2023
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@dotnet-policy-service dotnet-policy-service bot added the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 6, 2024
@wtgodbe wtgodbe removed the pending-ci-rerun When assigned to a PR indicates that the CI checks should be rerun label Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
@dotnet dotnet deleted a comment from dotnet-policy-service bot Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-signalr Includes: SignalR clients and servers
Projects
None yet
Development

No branches or pull requests

2 participants