orbitaloop/WebSqlSync

Not an issue - but questions

perqa opened this issue · 3 comments

The tables on the server, do they need to be identical to the tables in the web client? Like table names, number of columns, column names, etc?

A common case would be to store user information in a shared table on the server, where one column would contain user ID. However, in each client you only want data from one particular user, which means the two tables can't be identical. Does WebSqlSync handle that scenario?

What should the server-side output, and what should it accept as input? Is there any documentation for this?

Thanks for your work - it looks promising!

/Per Q A

Hi,

There is no limitation on the server side. Table can be different and should be different in your example with the table user (you need to add the column ID of course).

You need to write the server code (you can see an example of server code in Java with playframework in this projet), and I just added in the Readme an exemple of communication between the client and the server (input/output)

Hope this help. don't hesitate to contribute to the project (at least the Readme).

Best regards,

Sam

Thanks for adding the example to the ReadMe! Just a quick follow-up:

  1. in case the server-side database had been updated (and not the client), should the server output the same format as the client?
  2. in case both the client and the server had been updated separately before the sync occurs, what should happen, in what order?
  1. no, the server always send the same JSON format (and the client too). And it's always the client who starts the communication. So if there is no change on the client, it will send the JSON but with empty "data" and the server will answer with "data".

  2. the client initiate the sync, it will send the modified data to the server, and the server will answer with the modified data of the server case. In case of conflict, it's up to you (depending on your usecase) to define a strategy (ex. last update win...).