Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw error if data channel's buffer is filled, rather than closing.
Fixes #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.
- Loading branch information