W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2011

[whatwg] Websockets Client API

From: Bruce Atherton <bruce@callenish.com>
Date: Sun, 20 Feb 2011 17:34:37 -0800
Message-ID: <4D61C12D.9010207@callenish.com>
On 20/02/2011 2:57 PM, Robert O'Callahan wrote:
> It's not magic, the spec is perfectly clear. The language about "queuing a
> task" ensures that any callback events fire after the current task (e.g. the
> script event handler that created the Websocket connection) has run to
> completion.
>

Perhaps you are reading a different spec than I am. The only language I 
see about queuing tasks involves changing the ready state on the 
Websocket object. There is nothing in there about waiting until a block 
of other Javascript code has run before making any other event callbacks.

Let me see if I follow the "perfectly clear" line of reasoning you are 
using. Your assumption is that a Websocket connection will only be 
loaded in an event handler like window.onload. No other events will be 
delivered until the current event handler finishes. And the event 
handler that creates the Websocket object will necessarily also be where 
the event handlers are set on the Websocket object. By making all of 
these assumptions, it becomes obvious that within a browser this API is 
safe for callbacks. Do I have that right?

I am reminded of a joke about mathematicians. One argues that it is 
obvious that claim A follows from B. The other disagrees. After arguing 
for an hour, the latter finally agrees that A obviously follows from B.
Received on Sunday, 20 February 2011 17:34:37 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:04 UTC