Open andrewcostello opened 3 years ago
As far as I know, this is how it's intended to work. In browser with http
transport the same thing happens, my only solution is to use websocket
transport.
We have long-running XHR requests on the web that do not function this way.
I will wait for confirmation that this is the intended result. Thank you
It definitely should be possible to server-stream as-it-happens and not wait for the full result. It sounds like because this is working in the browser it has to be something about the react-native transport that's causing the issue. It was a contribution from @pbsf so maybe they know what's going on.
We have the same issue for our server side streaming grpc service. Really hope it can be solved.
+1
This is an huge issue. In this current moment, the library is not usable for handle streams inside a react-native project.
Just chiming in here that this is also affecting me and my company. Would love to find a solution to be able to consume streams from react-native
Maybe try connect.build/? This repository is no longer actively maintained.
Versions of relevant software used grpc-web v0.14.0
What happened GRPC stream requests made through React Native do not respond until the stream is closed.
What you expected to happen GRPC stream messages to be processed as they are received.
How to reproduce it (as minimally and precisely as possible): Add a sleep after stream.Send I added 5 seconds here.
func (s *bookService) QueryBooks(bookQuery *pb_library.QueryBooksRequest, stream pb_library.BookService_QueryBooksServer) error { for _, book := range s.books { if strings.HasPrefix(s.book.Author, bookQuery.AuthorPrefix) { stream.Send(book) time.Sleep(time.Second * 5) } } return nil }
All books will only be received when the stream closes.
Tested this in the browser and messages are received as the server sends them. Full logs to relevant components
Environment: