-
Notifications
You must be signed in to change notification settings - Fork 115
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
How do applications know a DataChannel's buffer capacity, so they can avoid filling it? #1148
Comments
I think this part is modeled after the web socket behavior (https://html.spec.whatwg.org/multipage/comms.html#dom-websocket-send). We could probably do better, but isn't this "standard" behavior, e.g. you can't find out how big objects you can post using fetch or xhr? |
taylor-b
added a commit
to taylor-b/webrtc-pc
that referenced
this issue
May 12, 2017
Fixes w3c#1148. Option 2 for fixing the issue. The application doesn't need to know the buffer's size ahead of time, because filling the buffer is no longer an irrecoverable error. If it doesn't care about latency, an application could send until an exception is thrown, then wait for the "bufferedamountlow" event until it can send again, similar to a non-blocking socket. Note that this is deliberately different than how WebSockets work, because the circumstances are slightly different: with WebSockets, it was expected that applications had code to handle them being closed unexpectedly. But this isn't true of WebRTC DataChannels, because before an SCTP-level timeout can occur, the application would have done an ICE restart and repaired the problem.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A well-behaving application that sends a large amount of data will use the "bufferedAmount" event and "bufferedAmountLowThreshold", to ensure it doesn't fill the DataChannel's buffer and cause the channel to be closed.
But how does the application know what to set "bufferedAmountLowThreshold" to? If the spec doesn't provide any guarantees about an implementation's buffer size, the application developer is forced to research how large different browsers' buffers are, pick a value low enough, and hope the browser buffers don't get smaller.
So I'd suggest either:
bufferSize
attribute (pretty straightforward)The text was updated successfully, but these errors were encountered: