Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to 3.0.5 api, intermediate work #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ssured
Copy link

@ssured ssured commented Sep 16, 2014

I'm trying to get this plugin to work with the new PouchDB 3.0.5.
Half success is accomplished, two browser can talk over the data channel to each other, but the exchanged rpcAPI object does not work for me. I get a this._bulkDocs(...) is undefined error when writing anything to the remote DB. My guess is there are changes to AbstractPouchDB on how custom adapters are registered, but from reading the source I could not figure this out. Your entry https://github.com/pouchdb/pouchdb/wiki/Writing-custom-adapters is the only thing I can find.

It would be cool to get this to work. More browsers are supporting webRTC, so it will become a real communication channel. My wish is syncing a mobile Chrome to a desktop Chrome, without having an intermediate server located database.

@dahjelle
Copy link

+1 :-)

@natevw
Copy link
Owner

natevw commented Oct 10, 2014

Thanks for starting this! I wonder if mainly the list of methods at https://github.com/ssured/PeerPouch/blob/efd896ff5bc30e4b2684b79e544bd6c2ee1e2609/pouch.webrtc.js#L78 just needs to be adjusted?

You probably noticed this already, but PeerPouch is implemented as an RPC system rather than a protocol. When you're using a remote DB locally, you're calling a (local) adapter whose methods just forward over to the remote instance for any actual processing. (And vice versa…the remote instance gets a proxy of all your callbacks.)

There were a few assumptions that this relies on — no synchronous return values [IIRC I worked around one or two unavoidable situations] and callbacks generally only called once [again there are a few places where exceptions are made]. Maybe the addition of Promises to PouchDB will require a bigger adjustment too.

Side note: would it be possible to put back the indented blank lines, or at least commit the whitespace changes separately? I'm guessing your editor makes that happen for you, but it's harder to review due to all that noise.

@ssured
Copy link
Author

ssured commented Oct 13, 2014

Hi Nate, this code was more or less just to save a little of my work, it's nowhere complete. About the whitespace, see https://github.com/blog/967-github-secrets, which tells about the ?w=1 param. Appending it to a diff url, it will strip all whitespace changes from a diff. See https://github.com/natevw/PeerPouch/pull/12/files?w=1.

The RPC implementation was clear to me. It's the easiest approach. Maybe the streaming protocol which is being developed will be even better suited, but thats not finished yet...

@natevw
Copy link
Owner

natevw commented Oct 14, 2014

Ah, cool tip on the whitespace, thanks!

@nolanlawson
Copy link

I'm happy to announce that pouchdb-replication-stream now runs in the browser. So it should be pretty easy to fix this plugin up to use that instead. :)

@ssured
Copy link
Author

ssured commented Feb 22, 2015

Great work @nolanlawson! This opens up a whole new set of possibilities 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants