[Bug 16703] I am suggesting a default value for the "code" argument to the close method. I am currently experimenting with this method and noticed that Chrome and Firefox seem to use different default values. If I do not specify a code, Chrome appears to use 1005 (

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16703

--- Comment #6 from Bronislav Klu&#269;ka <bronislav.klucka@bauglir.com> 2012-04-25 18:34:24 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > happen. Given the fact, that we have close codes in our disposal, sending no
> > code at all is bad practice, and although I'm usually not a fan of
> 
> Why?

I've actually wrote JS WS application and also my own server, and looking at it
from server position, connection can be dropped/close on socket level = fine,
there might be TCP/IP connection issue; connection can be closed using codes =
fine, server know, what is going on; 1005 = server has no clue what have
happened.

>From server-side application developer point of view, this may cause issues...
Imagine sharing files, sender opens WS connection, streams file and then closes
connection... 1000 means you can proceed with pushing the file to other
connection for download, some application level code can mean that you want
abort it, so file should be removed from queue and not pushed... if client side
developer forgets to specify code, what then? There can be number of similar
scenarios. 

And for every application you would have to specify what 1005 means, just
because someone is lazy to write down approx. 4 digits...
There's no generic meaning to it, it cannot mean that you should proceed as
normal close, because this is not normal close; you cannot proceed as this is
abort, because WS RFC does not specify application level codes...
Not to mention, that one application could treat it as OK, other application as
some sort of rollback, other application as some freeze state (let the file be
there but do not stream it yet...)

This essentially requires specifying some meaning to this protocol level code
on application level.

> 
> > specification telling what the good programming practice is, allowing to close
> > WS without any reason at all does not make any sense...
> 
> To force users to know close code and understand what he/she is doing by
> close()
> call, we should make code argument mandatory rather than having close() send
> 1000.

I could live with that (I would probably prefer that).

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

Received on Wednesday, 25 April 2012 18:34:31 UTC