- From: Iñaki Baz Castillo <ibc@aliax.net>
- Date: Sat, 10 May 2014 15:26:20 +0200
- To: Wolfgang Beck <wolfgang.beck01@googlemail.com>
- Cc: "public-webrtc@w3.org" <public-webrtc@w3.org>
2014-05-10 14:09 GMT+02:00 Wolfgang Beck <wolfgang.beck01@googlemail.com>: > Inside OS kernels, we have the same problem and have solved it decades > ago: run the sender when there is space in the queue. Run the receiver > when there is data available (but don't remove the received data from > the queue yet, the receiver might not be able to handle when its > upstream queues are full). > > In Javascript, this would translate into two callbacks: > onreceivedata() just tells the JS that it can get a message from the > datachannel now. > onsendspace() tells the JS that it can send a packet now > > recv() would fail with an exception, when there is no data available, > send() would fail with an exception, when the JS tried to send without > waiting for a onsendspace() event. The problem is that the DataChannel JS API mimics the WebSocket JS API (it is intentional), which behaves in the same way. -- Iñaki Baz Castillo <ibc@aliax.net>
Received on Saturday, 10 May 2014 13:27:07 UTC