-
Notifications
You must be signed in to change notification settings - Fork 45
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
Filtered replication #6
Comments
Can you provide a test to reproduce? socket-pouch runs the entire PouchDB test suite and there is definitely a filter test in there. |
To be exact, the changes do not replicate (perhaps they are filtered out at client side pouchdb). However I observe that data are still sent over the wire when looking at websocket frames in chrome debugger. This is different from couchdb HTTP long poll, since it doesn't emit out any data that don't match filter condition set by client. This is an undesired effect since unnecessary data are sent over to non-relevant clients. In my test case, 2 or more clients are listening for changes using different channels. However as mentioned, messages meant for channel A are sent to channel B as well. I'm still not familiar with pouchdb test suite, but my test code is as follows:
|
@hongnk hey i think you are missing something. you need to add design document in the localdb as well.follow below link and let me know if that works? This is critical bug i think if that does not work. please update as soon as possible |
This sounds like a separate bug. Can you confirm that the two clients have the same "messageId" and that's why they're getting the same messages? If two clients are getting the same messages, then that's a security issue and very different from a performance problem.
Yep, that's true. If you use an ad-hoc filter function, then the filtering will be done client side. However it seems like @hongnk is not doing that.
Here's how you can debug this: read the README guide to testing, which will set up the tests in a browser. Navigate to the test in a browser, add It's possible that the docs are unnecessarily being sent over the wire, but from what I recall of how I implemented this, that is not possible. |
Thanks nolanlawson for looking at this. I put all these codes in a working sample and attach here so you can test it out. It's a zip file but I rename as pptx to be able to upload here. Reproduction steps:
|
@nolanlawson when shall we expect this to be fixed?. |
@faraazc I am not currently putting socket-pouch high on my priority list, because it's a project I did for fun and am not currently using myself. So the answer is: never, unless somebody else takes it up. |
@nolanlawson Current:
Should be:
|
@pradiprv thank you the issue is confirmed fixed after adding if condition. Currently I also follow @nolanlawson suggestion, after instantiate socketpouchdb, overriding it with socketpouchdb.type() = function() { return "http"; } as a work-around. |
I tried following the related issues and can't figure out if this is fixed. Can you someone fill me in? |
@TomKaltz I have forked
|
The implementation has changed in current version 8.0.1, so above provided solution didn't work for me. However i could still find a solution. Issue:Facing 403 forbidden error on db replication over web sockets with a proxy server using library "socket-pouchdb". Solution:I could solve the issue just by setting "pouchdbinstance._remote = true". Explanation:While using web socket adapter "pouchdbinstance._remote" is not set to true. See code :
For "pouchdbinstance._remote = false/undefined", it makes a get call for doc_id = "_design_id/filter_name", which fails with 403 forbidden error. By setting db._remote = true, it does not make this get call and avoids 403 forbidden error. Implementation:
|
Using a couchdb backend, socket pouch doesn't read filter set in replication options and therefore emit all changes to all connected clients.
The text was updated successfully, but these errors were encountered: