W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2009

[whatwg] Issues with Web Sockets API

From: Maciej Stachowiak <mjs@apple.com>
Date: Mon, 27 Jul 2009 13:35:15 -0600
Message-ID: <C60BCCA0-730E-4679-B6CC-B32DDA555A2D@apple.com>

On Jul 27, 2009, at 1:16 PM, Alexey Proskuryakov wrote:

>
> 06.07.2009, ? 21:30, Ian Hickson ???????(?):
>
>>> postMessage() may want another exception condition... 'too much data
>>> pending exception'... consider calling postMessage in a while(true)
>>> loop... at some point the system is going to have to give up  
>>> queing the
>>> data if its not actually making its way out on the wire.
>>
>> The spec doesn't specify how UAs are to handle hitting hardware
>> limitations or system limitations, because it's often difficult to  
>> truly
>> control how those cases are handled.
>
>
> I agree with Michael that send() should not silently drop data that  
> could not be sent. It is very easy to fill send buffers, and if  
> bytes get silently dropped, implementing app-level acks becomes  
> quite difficult. With TCP, the basic guarantee is that bytes are not  
> lost until the connection is lost, so app-level acks only require  
> confirming the last processed command, and losing this guarantee  
> would be quite unfortunate. Most (all?) system TCP implementations  
> certainly have ways to deal with flow control.
>
> However, I do not think that raising an exception is an appropriate  
> answer. Often, the TCP implementation takes a part of data given to  
> it, and asks to resubmit the rest later. So, just returning an  
> integer result from send() would be best in my opinion.

With WebSocket, another possibility is for the implementation to  
buffer pending data that could not yet be sent to the TCP layer, so  
that the client of WebSocket doesn't have to be exposed to system  
limitations. At that point, an exception is only needed if the  
implementation runs out of memory for buffering. With a system TCP  
implementation, the buffering would be in kernel space, which is a  
scarce resource, but user space memory inside the implementation is no  
more scarce than user space memory held by the Web application waiting  
to send to the WebSocket.

Regards,
Maciej
Received on Monday, 27 July 2009 12:35:15 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:14 UTC