W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2011

Re: WebSocket feedback

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 31 May 2011 21:29:44 +0000 (UTC)
To: Simon Pieters <simonp@opera.com>
Cc: Adrian Bateman <adrianba@microsoft.com>, Jonas Sicking <jonas@sicking.cc>, Aryeh Gregor <Simetrical+w3c@gmail.com>, "Web Applications Working Group WG (public-webapps@w3.org)" <public-webapps@w3.org>
Message-ID: <Pine.LNX.4.64.1105312128490.26539@ps20323.dreamhostps.com>
On Tue, 31 May 2011, Simon Pieters wrote:
> On Tue, 31 May 2011 22:03:49 +0200, Ian Hickson <ian@hixie.ch> wrote:
> >
> > > We think this makes the design more future-proof because otherwise 
> > > and new information required prior to establishing the connection 
> > > will need to be added to the constructor arguments.
> > 
> > We can easily overload the constructor,
> 
> Overloading the constructor would work but having several orthogonal 
> optional arguments is bad API design, where you'd end up with something 
> like
> 
> new WebSocket(url, null, null, null, null, 'foobar');
> 
> instead of
> 
> new WebSocket(url, {foo:'foobar'});

Hard to say without knowing what the future extensions are going to be.


> > or delay the connection to the next time the event loop spins, 
> > allowing any additional needed information to be provided after the 
> > constructor has been called.
> 
> It seems bad to delay the connection just because the API designers 
> didn't think about future additions.

We're talking on the order of nanoseconds here, I don't see why that's a 
problem.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 31 May 2011 21:30:17 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:45 GMT