Nethravathitcs / unitt

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

websocket closes after doReadTimeout #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. open the connection 
2. do nothing
3. socket closes

What is the expected output? What do you see instead?
keep the connection open.

What version of the product are you using? On what operating system?
used source files(*.m) in the svn trunk. 
operating system: iOS

Please provide any additional information below.

Original issue reported on code.google.com by p.compas...@gmail.com on 20 Jul 2012 at 5:23

GoogleCodeExporter commented 8 years ago
Did you specify a ping time interval? Web sockets are supposed to close after a 
period of inactivity. If you wish to keep them open, you need to do one of the 
following (1) send a ping (2) set the time interval for automatic pings.

Original comment by joshuadmorris@gmail.com on 20 Jul 2012 at 6:15

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I did have a ping.(config.keepAlive = 10) 

I debugged a bit.
I open a socket.
I send a packet and receive a full packet.

inside - (void)completeCurrentRead
theCurrentRead nil-ed out.

maybeDequeueRead is called(not sure why this is getting called)
theReadQueue count > 0 
starts a new theReadTimer. and bang!

theReadQueue has only one place to remove object and it's inside 
maybeDequeueRead.
and maybeDequeueRead starts off theReadTimer whenever theCurrentRead == nil & 
theReadStream != NULL
(which reads to me, whenever we read a packet completely, we are starting the 
timer.. which is awkward )

Original comment by p.compas...@gmail.com on 23 Jul 2012 at 2:14

GoogleCodeExporter commented 8 years ago
Are you receiving the pongs from the server? There should be a delegate method 
to grab the pongs.

Original comment by joshuadmorris@gmail.com on 23 Jul 2012 at 2:53

GoogleCodeExporter commented 8 years ago
Didn't know I should implement a delegate mot hod for pong.  
I looked at the doc and source code and can't find the method signature.  

What's the name of the method?

Original comment by p.compas...@gmail.com on 24 Jul 2012 at 2:15

GoogleCodeExporter commented 8 years ago
WebSocket.h
@optional
/**
 * Called when pong is sent... For keep-alive optimization.
 **/
- (void) didSendPong:(NSData*) aMessage;

It is optional, but it will tell us if the server is returning the pong.

Original comment by joshuadmorris@gmail.com on 24 Jul 2012 at 3:49

GoogleCodeExporter commented 8 years ago
I thought that was called when I send pong..

In any way, I had that method in place, and still having the same error.

Original comment by p.compas...@gmail.com on 24 Jul 2012 at 5:19

GoogleCodeExporter commented 8 years ago
I'm an idiot. You are correct. I will add an optional method to determine when 
you receive a pong from the server. I just want to determine if the server is 
sending pongs. It could change the problem statement quite dramatically.

Original comment by joshuadmorris@gmail.com on 24 Jul 2012 at 2:32

GoogleCodeExporter commented 8 years ago
I found the problem and have begun work on a fix. Great find!

Original comment by joshuadmorris@gmail.com on 11 Aug 2012 at 5:05

GoogleCodeExporter commented 8 years ago
Hello,

I had to keep it as it was and work on something else.
So what was the problem?

Original comment by p.compas...@gmail.com on 16 Aug 2012 at 5:17

GoogleCodeExporter commented 8 years ago
This should be fixed in the 1.0.0 release.

Original comment by joshuadmorris@gmail.com on 11 Dec 2012 at 5:18