-
Notifications
You must be signed in to change notification settings - Fork 777
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
Use fetch instead of goog.net.XhrIo/XMLHttpRequest #1134
Comments
Just found out that using something like https://github.com/apple502j/xhr-shim lets me work around this problem easily! Update: xhr-shim doesn't work well (requests are sent but responses are not being received), but it seems like https://github.com/markis/sw-xhr does work. |
Glad you found a solution! 😃 More native Service Worker support would definitely be a plus for gRPC-web too :) |
FYI -- an update about the reason we cannot yet switch to fetch is provided in this related thread :) |
FYI, a solution regarding enabling Fetch was discussed below: |
Thanks @sampajano! Should we consider closing this issue in favor of the other one? |
@avm99963 Thanks for suggesting! The other issue is specifically addressing the service worker use case — while probably tightly related, is maybe a different context. So I think it's ok to keep them as separate for now. But whatever solution we come up with should address both.. :) Hope that makes sense :) |
I'm trying to use the gRPC-Web JS library inside a service worker, where XMLHttpRequest isn't exposed, so gRPC requests don't succeed (instead I get the error
ReferenceError: XMLHttpRequest is not defined
).The reason why I want to use gRPC-Web inside a service worker is that I'm developing a Chrome extension, and need to call a gRPC method every 30 minutes, which can only happen inside a service worker.
It would thus be great if the library used fetch instead of goog.net.XhrIo/XMLHttpRequest.
The text was updated successfully, but these errors were encountered: