grpc on react-native server-side streaming RPCs (1 request N responses) only send response on close
See original GitHub issueVersions 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:
- OS (e.g. from /etc/os-release): Android / React Native –>
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
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.