Closed struanb closed 8 months ago
thanks for raising this. it looks like sync is broken after recently upgrading the database dependency. I did not update the p2p sync code which is tightly coupled to the database.
in addition to the feature being totally broken, it didn't work that well when it was functional. I'd like to revisit this. previously i had to have all devices online at once to get reliable syncing, which is very inconvenient
I'm removing mentions of sync for now because the current implementation doesn't work. I looked into alternate sync methods and since this project doesn't use React it would be somewhat involved [1] to move over.
Syncing is a great option for a purely-client side application, but I agree it needs to be reliable.
In practice, without a central server or storage, I'm not sure I do see a way to implement syncing without at least a pair of clients being online at the same time.
A sync to cloud storage (e.g. S3) would at least still be serverless and very low cost to operate.
My current thinking is that I'll run a central sync server that clients can connect to. Anyone who wants to avoid the central server can self-host their own instance. This way individual clients, like mobile and desktop, can connect at separate times.
VLCN supports this use case and has a server implementation, but the client implementation, as far as I can tell, is wrapped in React hooks so I'd need to port it for use with Svelte. Not a simple drop-in solution unfortunately, otherwise I would have shipped this yesterday.
This is not yet in a versioned release, although the web version will have it
I tried this out at https://prompta-75701r67j-iansinnott.vercel.app/. I've copied the sync code from iOS Safari to MacOS Chrome.
On Chrome however, although the copied sync code is shown in the sync panel (and Connection is Active), there is no synced chat, and I've noticed that (undef Cmd-K Settings) the Database code still has a different hex code to the copied sync code, whereas back on iOS Safari the Database code shown has the same hex code as the copied sync code.
ah is that URL tied to this repository somewhere? The endpoint is actually https://prompta-production.up.railway.app/changes
, HOWEVER, it is still having some issues related to migrating the appropriate schema on the sync server.
Thanks for the stack trace.
ah is that URL tied to this repository somewhere?
I think i misunderstood your comment. if you want to try out the new sync use the usual https://chat.prompta.dev/ URL, it is built off of master
.
Ok sorry for misunderstanding. I think I clicked a link on your pull request.
Am testing now on https://chat.prompta.dev/ and am still getting no syncing (with no error reported in UI on iOS Safari, iOS PWA, or Mac Chrome). But Chrome dev tools still reports similar errors:
P.S. clicking restore DB or force sync does not help
Did you fix something? Clicking reload this morning on all my tabs/apps and the sync has succeeded everywhere.
@struanb yup, i updated the server earlier today and it's working in my testing as well. I'd like to add some sort of (more obvious) UI indicator of the syncing before releasing a new version but otherwise it's working in my testing.
Not that you need to wait for a new version since you're using we website.
Perhaps would be nice for the UI to indicate when it last successfully synced - and perhaps some hash or indication of the recency of the db at time of sync; so that, looking at different clients, it should be obvious if one is behind.
I added some in-app notifications / toasts to help make it more clear. This is in the web version and the -next
tag. might be good enough for 3.2.0, but I'm not yet convinced.
One issue i found with my own dataset was that if there were too many items the sync server would reject requests as too large. this has been resolved
Tentatively closing this as done. Anyone welcome to reopen if you find issues
Clicking 'Enable Sync' does absolutely nothing. I've tried this on Mac os Chrome, Mac OS desktop app, and iOS Safari.