reown-com / a2

An Asynchronous Apple Push Notification (apns2) Client for Rust
MIT License
150 stars 52 forks source link

Renewing tokens #15

Closed dbrgn closed 6 years ago

dbrgn commented 6 years ago

In the README you write:

If using a token connection, the connection should handle renewal of the signature before it's too late and for now I haven't seen any errors related to invalid tokens.

Is the lifetime of the JWT token tracked somehow? Is it the responsibility of the user to renew the signature? If yes, is there a way to renew the signature without recreating a client instance?

If this isn't being done yet, could this crate register a timer to auto-renew the signature, so that the user doesn't have to deal with it anymore?

pimeys commented 6 years ago

No, the signature is automatically renewed. Apple tells one hour, we do 45 minutes to be on the safe side.

It is all automatic and thread-safe, I should probably rethink the README.

dbrgn commented 6 years ago

Ah, I misread the readme. It says "the connection should handle". That was a statement, not a requirement towards the user :smile: Sorry.

pimeys commented 6 years ago

The documentation can always be better. I'm not a native English speaker, so corrections are appreciated.