We have a SPA that runs SockJs both client and server (NodeJs) side. For Windows workstations we have no problems maintaining web socket connections to servers deployed in Windows Azure. But for some colleagues using Mac OS X workstations they are experiencing in recent weeks frequent random disconnections for Web sockets. Happens on both Chrome or Firefox, so it appears to be at a lower OS level thing.
As far as they know there were no updates to OS X that might have affect the network stack. Don't seem to find any issues on SockJs either. Any troubleshooting tips for OS X?
So I managed to borrow one of my colleague's Macbook, and installed Wireshark on it.
Monitoring the HTTP traffic, I see the expected websocket upgrade exchanges taking place, and then, I notice TCP level RST reset packets sent from the server. Following that, the client workstation has to initiate a whole new HTTP connection and websocket upgrade again. Which eventually ends up in another RST from the server.
In trying to compare the situation on my Windows workstation, I found that the network stack automatically dispenses keep-alive ACK packets every 3-5 secs to the server. It appears the Mac OS network stack does not realise the existing HTTP connection has upgraded to websocket, and thus does not bother to deliver the ACK packets necessary to inform the server it's still alive.
To work around this on Mac, we have written our client to periodically send "ping" data to persist the websocket connection.