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

how to check health of the connection? #19

Closed
deamonwatcher opened this issue Apr 17, 2016 · 3 comments
Closed

how to check health of the connection? #19

deamonwatcher opened this issue Apr 17, 2016 · 3 comments

Comments

@deamonwatcher
Copy link

when i create a new client,how can i check health of it ?
In Apple Privider Api Doc, it said: "You can check the health of your connection using an HTTP/2 PING frame." In your "Push" fuction, you said:
"If the underlying http.Client is not currently connected, this method will attempt to reconnect transparently before sending the notification."
so, did i need do something else to keep alive of the connetion?

@sideshow
Copy link
Owner

sideshow commented Apr 25, 2016

Because we use the higher level HTTP Client which is designed to abstract the complexity of the underlying HTTP/2 connection and make it look like standard HTTP, currently there is no way to check the health of a connection.

That said, If you init a apns2.Client and hold on to it, it will stay open until something happens (network connection drops etc). In the advent that it does drop, it would just transparently re-connect the next time you call Push() and stay open again.

Theoretically you could do this if you dropped down to using x/net/http2 ping frames etc, but we haven't yet needed to do so. Just keeping a handle on the apns2.Client should be sufficient.

@c3mb0
Copy link
Contributor

c3mb0 commented Oct 10, 2016

See #45 for a potential solution.

@sideshow
Copy link
Owner

Closing as stale but have noted as a feature in #88

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

No branches or pull requests

3 participants