grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.51k stars 766 forks source link

Server-side streaming has buffering behavior #1245

Closed jasonclg closed 2 years ago

jasonclg commented 2 years ago

I'm curious if the buffering behavior of server is expected? doSayRepeatHello waits and sends back 5 messages at once right after call.end() was executed (buffering). What I expected was each message being written to stream and sent back immediately at 500ms interval but it's apparently not the case.

BTW, is it possible to send back messages without executing call.end()?

sampajano commented 2 years ago

Hi!

Curious if you're using mode=grpcwebtext or mode=grpcweb? Streaming is only supported for the former so if you use the latter it may seems like that response is buffered.

jasonclg commented 2 years ago

I'm using grpcwebtext mode. Besides helloworld, I tested Echo too. Response is also buffered.

sampajano commented 2 years ago

Ahh. then it's not expected.. streaming response should arrive as they're sent.

Maybe you could share more details about your configurations and check chrome network tabs to see what's the behavior as perceived on the browser side.

jasonclg commented 2 years ago

My network tab on testing Echo Two requests were sent when I typed "4 hello". 1 2

sampajano commented 2 years ago

Ah ok that's a bit weird..

I tried locally with the echo example and streaming works and here's what i saw in my chrome tab:

Screen Shot 2022-05-24 at 3 36 34 PM

The difference is that there's minimal "Waiting" in my case..

Not quite sure what the difference is..

jasonclg commented 2 years ago

@sampajano really appreciate your time on this! Closing this issue as I found the firewall/antivirus were the cause.

sampajano commented 2 years ago

Oh i see! Thanks so much for letting us know that firewall/antivirus was the cause! I had that initial hunch too but forgot to mention it.. 😃 Glad it works now :)