We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
No description provided.
The text was updated successfully, but these errors were encountered:
云端保存数据的难点在于 如何在多台设备都可能编辑数据的情况下,保证数据的一致性?,具体而言分为两个方面:
考虑到本项目是个人的腾讯云 云开发练手项目,所以希望能 以尽可能简单的方式实现功能。
当用户在设备 A/B 设备上都登录时,若在 B 设备上登录,则希望 A 设备能尽快感知到需要更新数据。
对于这种实时同步需求,常见的两种方案是 轮询 和 WebSocket,这里做个简单对比:
所以选择通过 轮询 的方式实现及时同步,具体细节如下:
若考虑 A 端在断网情况下编辑记录 X,B 端在联网情况下同样编辑记录 X,那么在 A 端恢复网络连接进行数据同步的时候,会存在冲突。
对于上述这种情况,肯定不出错的方案是让用户进行对比选择,不过这样子不仅增加了很多开发成本,也带来用户的使用成本,所以数据有冲突时采用如下的简单方案进行处理:
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: