0

I am using AppEngine's Channel API. This API disconnects the connection every 2 hours so I will have to handle the reconnection on my side whenever onError or onClose is called on the client side.

Problem is, I inserted the reconnection code in onClose or onError however channel is never being reconnected. Does anyone have working example of the Channel reconnection?

Thanks

user_1357
  • 7,766
  • 13
  • 63
  • 106

1 Answers1

1

I ran into similar problems. If I remember correctly, make sure you call close() on your socket. Also note that you can't reconnect to the same channel, you have to open a new channel after it times out. If you're still having problems, show your actual code.

dragonx
  • 14,963
  • 27
  • 44
  • You were right. Once the onError is called I had to explicitly close the channel before I can reconnect again. Is this a bug? I would assume that when onError followed by onClose is called ( I get disconnected call back as well) I would assume on the clint side the channel object would be closed as well. – user_1357 Dec 06 '13 at 03:25
  • It's been a long time since I debugged it. If I recall, the channel uses a hidden iframe, that doesn't get deleted until close() is called. The channel js always uses the same iframe, so it needs to be deleted before a new one is created. And somehow, when the channel times out, close() is not called automatically. – dragonx Dec 06 '13 at 04:23