couchbaselabs / react-native-couchbase-lite

Couchbase Lite binding for React Native Android & iOS
MIT License
110 stars 53 forks source link

Continuous change feed #118

Closed cboden closed 7 years ago

cboden commented 7 years ago

PR #41 introduced a change to enable a continuous feed listener to _changes but since the swagger refactor I'm not able to get this to work as everything is promise based now but this is one scenario where promises don't make sense.

How do I get a callback listening to streamed changes?

jamesnocentini commented 7 years ago

In the example app, we use longpoll instead of continuous https://github.com/couchbaselabs/mobile-training-todo/blob/master/react-native/app/Feed.js which provides the same information but in a different way.

Continuous might work with callbacks instead of promises but I haven't tried it so can't say for sure. Otherwise, the best option is probably to extend the swagger client in the react native plugin with a method to consume the continuous feed.

cboden commented 7 years ago

I ended up going with the Feed example...it worked at first, on launch but when I update a document on the server, it does get replicated to the client (I verified with Couchbase Lite Viewer) but the feed never responded...

cboden commented 7 years ago

whoops, that last issue was my bad.

I'll look into continuous if I get some spare time but for now using recursion + long polling can emit the same.