Firefox Websocket connection does not close after closing tab or browser

I tested the connection in google chrome browser, connecting and disconnecting is ok, but why doesn't firefox close the connection after closing it?

I tried to add this piece of code:

$(window).on('beforeunload', function(){


but it didn't help, are there any other hacks to solve this?

Also I tried on the server side:

byte d = bytes[0]; //first byte
if(d == 0x8)


but didn't help, other hacks?


source to share

All Articles