Actually check the connection status, not just if the socket exists
Try to deal with the mysterious websocket disconnections