Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy the gateway connection on error, so reconnection works also when the connection is dropped instead of closed. #3

Merged
merged 1 commit into from
Nov 19, 2013

Conversation

nvh
Copy link
Contributor

@nvh nvh commented Nov 14, 2013

When an error occurs and the apns server drops the connection, sometimes the live agent does not reconnect correctly. Apparently the 'close' event is not fired when when the connection is dropped suddenly from the remote side.
I was able to reproduce this by sending lots of notifications to non-existing device tokens (and thus receiving error 8). Be careful when testing this though, at some point the server stopped accepting my connections :)

Because by design the apns server always closes the connection on error (see the docs), it is safe to destroy the gateway on our end when encountering an error. This results in the close event being fired and the reconnection being started.

I'm not sure, but I guess this is also the source of the problems in issue #1, the behavior that is described there is exactly what I encountered when discovering this issue.

…hen the connection is dropped instead of closed.
@bf
Copy link

bf commented Nov 19, 2013

Will this be merged?

@logicalparadox
Copy link
Owner

This makes perfect sense. Good catch.

logicalparadox added a commit that referenced this pull request Nov 19, 2013
Destroy the gateway connection on error, so reconnection works also when the connection is dropped instead of closed.
@logicalparadox logicalparadox merged commit 81ff811 into logicalparadox:master Nov 19, 2013
@logicalparadox
Copy link
Owner

Released: 1.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants