Re: [webrtc-pc] RTCDataChannel.bufferedAmount value

> But I want to know whether there's a particular reason why it needs to be that way

Because then you can reliably check `bufferedAmount` to avoid calling `send` when the buffered amount is above some threshold. It guarantees that `bufferedAmount` is always greater than or equal to the actual buffered amount.

For example:

```
while (haveDataToSend()) {
  if (dc.bufferedAmount > bufferFullThreshold) {
    // bufferedamountlow event will cause us to resume sending.
    break;
  } else {
    dc.send(getChunkToSend());
  }
}
```

-- 
GitHub Notification of comment by taylor-b
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1823#issuecomment-378083997 using your GitHub account

Received on Monday, 2 April 2018 23:53:07 UTC