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: XHR Transport and Fetch Transport for React Native support (among others) #348

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

fundthmcalculus
Copy link

@fundthmcalculus fundthmcalculus commented Apr 19, 2023

After spending several days working on react native for grpc, I was able to adapt the @improbable-end/grpc-web-react-native-transport to work with nice-grpc-web. This enables support for grpc web in react native where websockets are not supported.

Also, added support for fetch api in cases where arrayBuffer() is not supported. blob() mode is supported, but only in a base64 format. Hence the optional blobMode configuration parameter.

@aikoven
Copy link
Contributor

aikoven commented Apr 20, 2023

Thank you for your contribution @fundthmcalculus!

I will happily merge the PR once the tests turn green. Please ping me if you need any assistance.

Mind the flaky tests with traefik though. Ignore errors like in this run: https://github.com/deeplay-io/nice-grpc/actions/runs/4736697563/jobs/8409567422

@fundthmcalculus
Copy link
Author

Thanks for the quick feedback! I've actually got another change I'm going to bring into this PR which will enable fetch APIs when you don't have file reader support on react native.

@fundthmcalculus fundthmcalculus changed the title feat: XHR Transport for React Native support (among others) feat: XHR Transport and Fetch Transport for React Native support (among others) Apr 20, 2023
@fundthmcalculus
Copy link
Author

@aikoven if you could take a look as to why the tests are failing, I'd really appreciate it.

@aikoven
Copy link
Contributor

aikoven commented Apr 29, 2023

The NodeJS tests fail because of this error:

ReferenceError: FileReader is not defined
  at /home/runner/work/nice-grpc/nice-grpc/packages/nice-grpc-web/src/client/transports/fetch.ts:16:24

The browser tests are hanging for some reason. You can try running them locally using

yarn test:local-browser-headless

from the packages/nice-grpc-web directory. You need to have Docker running.

@hollanderbart
Copy link

@fundthmcalculus What's the status of this PR? Can you please fix the failing tests? It would be nice to use it in our app, because grpc support in react native isn't really supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants