grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

client receives all the messages at once when using server-side streaming?

Open sfariv opened this issue 4 years ago • 7 comments

Hi, I was wondering if that's still a expected behavior I am seeing? client receives all the messages at once when using server-side streaming

I noticed this feature was a WAI back in 2019 https://grpc.io/blog/state-of-grpc-web/#f20

I was wondering if this is still not supported?

sfariv avatar Jun 10 '21 00:06 sfariv

I also have this issue that client does not receive any messages when server sending messages and when the server closes the stream, client receives all messages

I tested this issue by go grpc stream client and works correctly and client receives messages when server send it

saman-pasha avatar Jun 19 '21 11:06 saman-pasha

Solved! just use grpcwebtext protoc --js_out=import_style=commonjs:. --grpc-web_out=import_style=commonjs,mode=grpcwebtext:. events/events.proto

saman-pasha avatar Jun 19 '21 12:06 saman-pasha

I noticed the same thing over a year ago, and got this patch on my fork (that I've been a bit lazy to put as a pr, my bad)

https://github.com/sergiocampama/grpc-web/commit/ebdf6795c94cbe6867077d98747206b7dff28f6a

sergiocampama avatar Jul 08 '21 05:07 sergiocampama

hadn't read that blog post before, wondering if this was an avenue explored and discarded for some reason

sergiocampama avatar Jul 08 '21 05:07 sergiocampama

Does this issue have some update? I'm with the same problem.

lukasmuller10 avatar Jan 27 '22 16:01 lukasmuller10

Hi! Thanks for the report and sorry for the delay in response!

I don't believe this is expected.. 😃

If you follow our echo example, are you still observing the same behavior?

One possibility is that there is a firewall or proxy which is buffering the HTTP responses until the response is complete, in which case it would example why streaming doesn't work. Could it be something that's happening here?

Thanks! :)

sampajano avatar Jan 28 '22 01:01 sampajano

Just to sum up, according to grpc, in grpcweb mode, you will receive all messages at once, when the stream closes. If you want to receive messages one by one you need to use the grpcwebtext mode.

So to solve this issue, you need to use different command (specifically the --grpc-web_out part), while generating files with protoc.

Cupprum avatar Nov 11 '22 18:11 Cupprum