If I disable network I will be notified by - (void)webSocket:(SRWebSocket )webSocket didFailWithError:(NSError )error and socket will be closed.
But if network interface is enabled and all packets are lost I won't be notified and socket won't be closed.
I use ping-pong mechanism to know that socket is alive and all packets is sent. And when ping-pong fails three times I try to close socket. But socket is never closed and readyState is always SR_CLOSING. And one more thing is that I can't just release SRWebSocket instance because one retains itself before it will be closed.
How can I force close or release instance and clean all resources to prevent memory leak?
You can simulate bad network by choosing 100% Loss preset in Network Link Conditioner.
If I disable network I will be notified by - (void)webSocket:(SRWebSocket )webSocket didFailWithError:(NSError )error and socket will be closed.
But if network interface is enabled and all packets are lost I won't be notified and socket won't be closed. I use ping-pong mechanism to know that socket is alive and all packets is sent. And when ping-pong fails three times I try to close socket. But socket is never closed and readyState is always SR_CLOSING. And one more thing is that I can't just release SRWebSocket instance because one retains itself before it will be closed. How can I force close or release instance and clean all resources to prevent memory leak?
You can simulate bad network by choosing 100% Loss preset in Network Link Conditioner.