Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

messages sent from server to browser are fragmented somewhere #93

Closed
Tiger-I-Yang opened this issue Sep 17, 2023 · 7 comments
Closed

messages sent from server to browser are fragmented somewhere #93

Tiger-I-Yang opened this issue Sep 17, 2023 · 7 comments

Comments

@Tiger-I-Yang
Copy link

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
Copy link
Member

What is a message?

@Tiger-I-Yang
Copy link
Author

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

@marten-seemann
Copy link
Member

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
Copy link
Author

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
Copy link
Author

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

@marten-seemann
Copy link
Member

QUIC makes no such guarantees.

@Tiger-I-Yang
Copy link
Author

got it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants