quic-go / webtransport-go

WebTransport implementation based on quic-go (https://datatracker.ietf.org/doc/draft-ietf-webtrans-http3/)
https://quic-go.net
MIT License
330 stars 52 forks source link

messages sent from server to browser are fragmented somewhere #93

Closed Tiger-I-Yang closed 1 year ago

Tiger-I-Yang commented 1 year ago

I noticed that when sending messages via streams from a Golang server to a browser client, sometimes the message arrives whole, while other times the browser receives a collection of smaller messages instead. In these cases, the smaller messages combined seem to form the message I intended to send.

What's going on here? is this behavior intended? and if so, can we have it so that the browser withholds the messages until it fully arrives.

marten-seemann commented 1 year ago

What is a message?

Tiger-I-Yang commented 1 year ago

by messages I mean each byte slice that is used to call the webtransport.SendStream.Write() method is a message.

marten-seemann commented 1 year ago

QUIC streams are byte streams. There's no such thing as messages, and there are no guarantees whatsoever how byte slices passed to Write might be split.

Tiger-I-Yang commented 1 year ago

so each time I call webtransport.SendStream.Write(), it's not sending the byte slice immediately but instead adding it to an internal buffer to be packetized as the transport sees fit? I thought every time I call the method, I'm sending a discrete chunk of data

Tiger-I-Yang commented 1 year ago

for context, I'm sending compressed video frames, where the points where one frame ends and another begins is important.

marten-seemann commented 1 year ago

QUIC makes no such guarantees.

Tiger-I-Yang commented 1 year ago

got it