[whatwg] Web Sockets API — send() with closed connections

Avi Flax avif at arc90.com
Sun Oct 25 10:12:45 PDT 2009


My apologies if this has been answered before; I searched the list and
found some similar questions but no answers.

I just read the latest draft of this API, and it's great, very exciting.

Just one thing struck me as odd: calling send(data) on a WebSocket
whose readyState is CONNECTING raises an INVALID_STATE_ERR exception,
but calling send(data) on a WebSocket whose readyState is CLOSED does
not raise an exception; it merely returns false.

This is confusing to me; I would think that a WebSocket which is in
the process of connecting is in an invalid state for sending data,
then one which has closed its connection is also in an invalid state
for sending data.

I'd really appreciate it if someone could explain the rationale for
this to me. And I might also suggest that calling send(data) on a
WebSocket whose readyState is CLOSED _should_ raise an exception — but
I should probably wait to see first what thinking has already gone
into this — I'm sure brighter minds than I have thought this through.

Thanks!

Avi

--
Avi Flax » Partner » Arc90 » http://arc90.com



More information about the whatwg mailing list