gauntface / web-push-go

Apache License 2.0
99 stars 14 forks source link

Implement exponential back-off #4

Open x1ddos opened 8 years ago

x1ddos commented 8 years ago

The Send(...) should implement exponential back-off when sending the requests. Given that this package is very young, I think it's not too late to change the signature to something like:

Send(ctx context.Context, client *http.Client, sub *Subscription, message, token string) (*http.Response, error)

Then, the function should be able to re-try until an unrecoverable error is received or ctx is cancelled by the Send caller. ctxhttp can help with the latter. I think.