girishPC / unitt

Automatically exported from code.google.com/p/unitt
0 stars 0 forks source link

reconnect #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
It would be nice if there was a reconnect mechanism built into the WebSocket 
client.  I.e. something to specify the client should try every n seconds to 
reconnect after a connection attempt fails.

I wrote a timer into my project that checks to see if the socket has been 
disconnected and attempts to reconnect, but I am having issues with memory 
leaks and exc_bad_access.

Original issue reported on code.google.com by ryanag...@gmail.com on 15 Sep 2011 at 9:05

GoogleCodeExporter commented 8 years ago
Your delegate's didClose:message:error method should be called when you are 
disconnected, unless you were never connected at all. This should be a great 
place to reconnect. I was going to change this to an enhancement request, but 
you said you had issues with memory leaks. What exactly is leaking?

Original comment by joshuadmorris@gmail.com on 15 Sep 2011 at 11:58

GoogleCodeExporter commented 8 years ago
One of the first things I tried was having [ws open] in my didClose.  After a 
couple attempts it crashes with:

Assertion failure in -[AsyncSocket doCFWriteStreamCallback:forStream:], 
/Users/jmorris/Projects/xCode/UnittWebSocketClient/UnittWebSocketClient/AsyncSoc
ket.m:2838
2011-09-16 09:46:01.898 WebSockApp[25618:207] *** Terminating app due to 
uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid 
parameter not satisfying: theWriteStream != NULL'

So then I tried to work around it by trying to re-initialize the WebSocket -- 
which seemed to prevent a crash but running it in Leaks showed each time I did 
that it was leaking memory.

Original comment by ryanag...@gmail.com on 16 Sep 2011 at 1:54

GoogleCodeExporter commented 8 years ago
Can you send me a sample snippet of your code? I have tried reproducing this 
and I can close and re-open at will.

Original comment by joshuadmorris@gmail.com on 21 Sep 2011 at 1:52

GoogleCodeExporter commented 8 years ago
I am marking this as invalid. Feel free to reopen when you send me some sample 
code so I can verify. :)

Original comment by joshuadmorris@gmail.com on 27 Sep 2011 at 9:10