Hi
The PouchDB api has a {retry: true} setting for its db.sync() method. This works well when the replicator loses its connection in the middle of a session, however if no connection can be established initially when db.sync() is called, the replicator won't try to connect when the server is available again. I'm trying to handle the case where the web page is loaded offline, but goes online later, and should start syncing.
I worked around this by manually retrying the db.sync() if the replication was never started. This works except I get a memory warning from Pouch saying I've attached too many event handlers after ~10 retries. I tried resolving this by calling .cancel() on the object returned by db.sync() before retrying, however the .cancel() method is not available if the initial connection fails.
Any ideas on how to properly retry initial replication connections, or how to clean up the callbacks attached by (presumably) the db object by pouch?
Also, what's the best way for telling when a replication is active? It seems that, if there's no data to replicate. I have a solution that works in practice; if either "active" or "paused" is thrown, the replicator was connected. This is for an android wrapper app so webkit only solutions are fine.
Thanks for a great product!
Johan Baversjo