[whatwg] WebSocket closing handshake

Simon Pieters simonp at opera.com
Fri Apr 30 05:07:45 PDT 2010

start the WebSocket closing handshake:

Note: The closing handshake finishes once the server returns the 0xFF  
packet, as described above.

I assume it should say 0xFF frame, not packet.

This note is only true when the client sends the closing handshake first.

...except that I can't find anywhere in the server part to send 0xFF 0x00  
when it receives 0xFF 0x00 from the client. I just see:

5. If type is 0xFF and length is 0, then set the client terminated flag  
and abort these steps. All further data sent by the client should be  


At any time, the server may decide to terminate the WebSocket connection  
by running through the following steps:

Send a 0xFF byte and a 0x00 byte to the client to indicate the start of  
the closing handshake.

Wait until the client terminated flag has been set, or until a  
server-defined timeout expires.

Close the WebSocket connection.

I'm confused at this point how the closing handshake is supposed to work.

Once these steps have started, the server must not send any further data  
to the server. The 0xFF 0x00 bytes indicate the end of the server's data,  
and further bytes will be discarded by the client.

s/to the server/to the client/

Simon Pieters
Opera Software

More information about the whatwg mailing list