Open w4rum opened 3 years ago
I found an example on other repo which gave me knowledge to complete my task. I'm developing a go
gRPC server wih a node
client. I was expected to download a file from server using stream server pattern but with this package I found a lot of latency and unexpected problems while download stream data.
As you mentioned, data is supplied as whole when the stream server ends.
This guy really helped me: https://github.com/aditya-sridhar/grpc-streams-nodejs-demo/blob/master/client_grpc_server_stream.js
Currently, a promisified streaming-response function returns a promise that resolves when the server ends the stream. One use-case of streaming-response RPCs is, however, that the client processes the reponse stream while the server is still executing the response. With the current implemenation, this is not possible, as the client receives the data in one go, when the stream completes.
This also makes it impossible to use infinite streams, as that causes the client to wait indefinitely.
Minimal example, JS client:
Python Server (based on grpclib and betterproto, see this issue for details; this part is working and not the cause of the problem mentioned here):
As a temporary work-around, I only promisify unary/unary functions:
I'm not quite sure how this could be done with promises but it would be nice to be able to register an
onData
callback somehow and still retain the nicer syntax that the promisified functions provide.