-
Notifications
You must be signed in to change notification settings - Fork 13
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
Select DB to be synched by each browser #9
Comments
No it is currently not possible to have one instance of the sync-server synchronising different DBs. All tables found in the path of the sync-server instance will be synched. If you want to sync different DBs you will need a different sync-server instance for each DB. |
Thanks for your answer @nponiros . Digging a bit into the code I've found a way to pass the table name I want to sync with, in the connection Of course it would be better to perform the filter at the server side :) Now I'm looking for a way to sync from a certain sync revision number that I'm also passing in the connection options. Sych revision number would be used here https://github.com/orgs/reTHINK-project/projects/3 in the Let me try to explain the overall scenario. In order to enable offline peers receive message when they are back online, one of the peers (primary) is syncing the local storage with the sync-server. ie they would query the sync-server about messages sent when they were offline. When the primary peer goes offline another peer tries to take its role and resume the sync of the local storage with the sync-server using the last synced revision. Everytime there is a new sync revision (retrieved by the primary peer from appliedRemoteRevision in the _syncNodes table ) it publishes it to all other peers. Such revision number is then used by new primary peers when resuming the sync with the remote sync-server to avoid loading the full data. However, when connected using such revision number, my local changes are never sent to the remote server. I've tried to increase or decrease the revision but it doesn't work Is this the expected behavior? Am I missing something? Thanks a lot for your time |
The You wrote about the _syncNodes table so maybe you are already changing something in dexie-syncable and I just don’t fully understand the issue yet. |
I didn't touch dexie-syncable perhaps I should also post an issue in the Dexie repo. |
At the end I realized I had something wrong in my test. I'm able to send local changes to sync-server as soon as the sync point I set in the connection options matches the one I see in the sync-server web page: However, this revision number I see in the web page is not incremented with changes sent to sync-server. But checking sync-server responses, the revision number is indeed incremented: If I use this revision number to set the sync point in the connection options I got this error: "Error: Error Can't insert key , it violates the unique constraint" I suspect this error is caused by the mismatch between the revision number I see in the sync-server web page and the one retrieved from the sync-server responses and saved in the _syncNodes table |
It would be interesting to figure out which insert/update triggered the constraint error. Was it your data or a syncNode. I don’t remember when the revisions are increased and who does it. As I said the sync-client itself doesn’t do much. The heavy lifting is done by dexie-syncable and the sync-server. You would probably have to read the dexie-syncable code to know what exactly happens. I might have some time for it in the next couple of days but I can’t promise anything. |
Ok I've tried without the Now, we trying to use it with WSS, and the sync-server is configured with:
However, we see a connection error on the |
I never found the time to implement websockets support for the sync-client. Only the sync-server supports websockets. The /check call is needed only for the poll protocol because you do not have a permantent connection to the server. With websockets you are either connected (you are online) or disconnected (you are offline). If you use a websocket, the current version of the sync-client won’t add much value. Do feel free to implement websocket support and open a pull request :) |
:) any hint ? Any syncable implementation currently working with sync-server WSS? |
This https://github.com/dfahlander/Dexie.js/tree/master/samples/remote-sync/websocket might be a good start. I’m afraid that I don’t have anything better to offer currently |
Hi, is it possible to have multiple browsers each one syncing different DBs in the same sync-server?
For example, having browser A syncing DB X with browser B and browser C syncing DB Y with browser B.
So far I've only managed to have all DBs synched among all browsers connected to the same server
thanks
The text was updated successfully, but these errors were encountered: