[whatwg] [hybi] WebSocket sub protocol name.

Ian Hickson ian at hixie.ch
Tue Dec 8 00:31:28 PST 2009


On Tue, 8 Dec 2009, Yuzo Fujishima wrote:
> On Tue, Dec 8, 2009 at 4:59 PM, Ian Hickson <ian at hixie.ch> wrote:
> > On Tue, 8 Dec 2009, Fumitoshi Ukai (榈~\椋兼~V~G鎫U~O) wrote:
> > > protocol now accepts U+0020. Is it ok to use U+0020 only in /protocol/ ?
> > > (e.g. new WebSocket("ws://example.com/", " "); )
> > > It seems space is optional after colon in field of handshake message, how
> > > can we distinguish U+0020 and U+0020 U+0020 ?
> > 
> > The space isn't optional (both the client and the server are required 
> > to send it before the subprotocol name), it's just that the client 
> > will handle a missing space gracefully. Maybe we should remove that 
> > "feature", and require that the space be present, closing the 
> > connection otherwise? I don't feel strongly either way.
> > 
> > Anyway, the point is that "WebSocket-Protocol: " is the empty string, 
> > and "WebSocket-Protocol:  " is a one-space protocol name.
> 
> Hi, Ian, let me confirm one thing: Empty string is not allowed for 
> subprotocol, is it?

The API will throw if the string is empty. However, if no protocol was 
specified, and the server returns an empty WebSocket-Protocol, it's 
ignored (as would any other WebSocket-Protocol value sent by the server in 
that case).

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'


More information about the whatwg mailing list