On 11 août 2015, at 18:12, Guido van Rossum <[email protected]> wrote:

> Hm... The way I read that it seems to say that you shouldn't just close the 
> socket if the last thing you did was send some data and you'd like to be sure 
> it was received. I can't disagree with that (SSL has a similar idea IIRC), 
> but it seems a stretch from there to wanting to do this when the server is 
> just stopped with ^C (as in your example below).


Indeed, that paragraph offers a reason why the closing handshake exists but 
doesn’t contain the normative details.

They are found later and they mandate a closing handshake in all cases:

> 7.3.  Normal Closure of Connections
> 
>    Servers MAY close the WebSocket connection whenever desired.  Clients
>    SHOULD NOT close the WebSocket connection arbitrarily.  In either
>    case, an endpoint initiates a closure by following the procedures to
>    _Start the WebSocket Closing Handshake_ (Section 7.1.2).

There’s also a dedicated close code for “server going down”, 1001, which 
implies that a closing handshake is expected in that case.

-- 
Aymeric.

Reply via email to