Question about _changes REST API

For my cordova app, I’m working on rebuilding the Coax.changes() functionality using the fetchjs library. I want the webview to be able to update accordingly when there are changes to couchbase lite. I prefer fetchjs because of promises, which is so much easier to follow than callbacks.

I see that the “feed” query param accepts:
normal, continuous, eventsource, longpoll

Can someone explain how these types of feeds work and how I can handle them with fetchjs?

agillette, that sounds awesome! I hope you can publish this work open
source.

Normal: the _changes endpoint will return immediately with any results it
has
Longpoll: typical HTTP longpoll – the server will let the client HTTP
request stay open for a fixed amount of time (sorry, don’t remember the
default – maybe 5 minutes). as soon the server has new results it will
return them to the client.
Continuous: Like HTTP longpoll but the socket is never closed. I would
just ignore this one, it’s not widely used.
EventSource: I think this is specific to the coax library and you can
probably ignore it. I believe it was added to provide an easier to use
interface for application code to be notified of new changes.

Hi @traun,

It looks like I can’t re-implement changes() because fetch does not support streams.

But thanks for the info on the feed options.

Question about longpoll. If it times out, is changes() suppose to retry again?