ghedipunk / PHP-Websockets

A Websockets server written in PHP.
BSD 3-Clause "New" or "Revised" License
917 stars 374 forks source link

server closing connection not cleanly #47

Open Xaraknid opened 9 years ago

Xaraknid commented 9 years ago

It's seem the server never send any close opcode neither close status code.

if the close handshake was respected and all goes normal server should send close opcode with 1000 as status code or without status code be sent i should see 1005 status code instead I allways receive 1006 stand for abnormal closure mean the transport was kill prior to sending close opcode.

That applied either if client request the closing handshake first or server closing the connnection for any reason it's seem he to slam the connection down.

You can see status code on client side even see if the websocket connection was close cleanly.

socket.onclose   = function(msg) { 
console.log(msg.code);
console.log(msg.wasclean);   
log("Disconnected - status "+this.readyState);
};

Maybe mimicking the browser with is readystate closing state applied after an endpoint send close opcode in this state you could skip all remainning data on the wire untill you recieve close opcode response.

As you can reconnect the websocket automaticaly without any user intervention but I want only to reconnect when the connection really close abnormal.