gimite / web-socket-js

HTML5 Web Socket implementation powered by Flash
BSD 3-Clause "New" or "Revised" License
2.73k stars 488 forks source link

Silently fails? #63

Closed mrchess closed 12 years ago

mrchess commented 13 years ago

I don't have much information other to say that sometimes after 15 mins of an open socket, the socket fails to receive information from the server.

I can still send to the server from the client, but the server can't send back up. In addition, since the socket is not "officially dead" it doesn't kill itself and trigger some sort of "disconnected" event.

I will investigate further but wanted to write just in case anyone has experienced a similar issue.

Specs: FF3.6.16 / Flash WIN 10,2,153,1 / No proxies / Same domain / Not using insecure

gimite commented 13 years ago

After the issue happens, can the server still receive the message from the client? Or client can send message without error but it doesn't reach server?

Some routers disconnect TCP connection when it has no packets for long time. Sending dummy packet periodically (e.g. every minute) should workaround it if it's the case.

gimite commented 13 years ago

Also it would be informative to see if it happens in Chrome's native Web Socket.

mrchess commented 13 years ago

Yup, I had the browser regularly send a heartbeat packet every 3 seconds.

After the issue happens, the server can still receive messages from the client, but the client cannot receive messages from the server.

I am conducting some tests right now. Will let you know if I come up with anything.

mrchess commented 13 years ago

I just did some local tests to see if the socket dies after 30 minutes.

In my first test I only sent a packet (by packet I mean a SEND call) from client -> server every 30 seconds, along with a heartbeat packet from the client -> server every 3 seconds. This kept the socket open for 30 minutes.

In my second test I reversed the 30 second packet to go from server -> client every 30 seconds, but I kept the heartbeat packet from client -> server every 3 seconds.

Both tests were successful at keeping the socket open for at least 30 minutes (and stuff could be sent both ways).

This makes me believe it was my live implementation that causes the problem. In my tests I only send a couple packets, but in my live site I have up to 50-100 packets of information travel per second per user, and around 150-200 clients connected at a time.

That being said I don't know how to replicate it on my local machine, sorry. Just wondering -- is the flashsocket designed to handle 50-100 send calls per second?

gimite commented 13 years ago

I myself haven't tried such volume, but it should work unless either server or client is overloaded. I think kanaka did some test with large volume. Again, it would be informative to try it with Chrome. web-socket-js just uses native WebSocket implementation in Chrome.

gimite commented 12 years ago

Closing for now. Please reopen with more information pointed above if this is still an issue.