How to design a multi-user ajax web application to be concurrently safe

前端 未结 8 1153
梦谈多话
梦谈多话 2021-01-29 16:59

I have a web page that shows a large amount of data from the server. The communication is done via ajax.

Every time the user interacts and changes this data (Say user A

8条回答
  •  庸人自扰
    2021-01-29 17:33

    I can't believe that nobody has mentioned Meteor. It's a new and immature framework for sure (and only officially supports one DB), but it takes all the grunt work and thinking out of a multi-user app like the poster is describing. In fact, you can't NOT build a mult-user live-updating app. Here's a quick summary:

    • Everything is in node.js (JavaScript or CoffeeScript), so you can share stuff like validations between the client and server.
    • It uses websockets, but can fall back for older browsers
    • It focuses on immediate updates to local object (i.e. the UI feels snappy), with changes sent to the server in the background. Only atomic updates are allowed to make mixing updates simpler. Updates rejected on the server are rolled back.
    • As a bonus, it handles live code reloads for you, and will preserves user state even when the app changes radically.

    Meteor is simple enough that I would suggest you at least take a look at it for ideas to steal.

提交回复
热议问题