How to do live updating similar to Google Docs?

前端 未结 11 812
孤街浪徒
孤街浪徒 2021-01-30 09:07

I want to do something very similar to Google Doc\'s live updating - where all users can \"immediately\" see the actions of the other users in the doc.

To achieve this,

11条回答
  •  不思量自难忘°
    2021-01-30 09:44

    One way to limit the # of ajax requests is to get clever with spacing them out. You don't need to make a request every second. When you get a response with activity, then do another request in 1 second. If no activity, then 2 seconds, then 4, etc, with maximum of maybe 30 seconds in between requests. When updates happen, reset the timer. Basically, space your requests in a smart way to make the GUI look as responsive as possible.

提交回复
热议问题