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

feat: add react-native streams support #55

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

D4ryl00
Copy link
Contributor

@D4ryl00 D4ryl00 commented Oct 23, 2023

This PR adds the stream function to the React-Native gRPC transport.
Because the fetch API is not fully implemented in React-Native (see issue here), I had to polyfill the missing fetch function (package here) and replaced some functions in the global namespace (see here).

On Android, text-streaming doesn't work out-of-the-box on the debug variant. One solution is to comment the NetworkFlipperPlugin (see here). Because we don't use it for the moment, I commented that plugin.

I added a HelloStream API function to test the stream feature.
We can call it in Reac-Native by doing this:

for await (const res of clientInstance.helloStream(new HelloStreamRequest({ name: 'd4ryl00' }))) {
  console.log(res.greeting);
}

@D4ryl00 D4ryl00 self-assigned this Oct 23, 2023
Copy link
Contributor

@jefft0 jefft0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The HelloStream example works for me on Android and iOS simulators.

@D4ryl00 D4ryl00 merged commit 99510ab into gnolang:main Oct 24, 2023
@D4ryl00 D4ryl00 deleted the feat/add-streams branch October 24, 2023 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants