How does one do realtime updates of a web page?

后端 未结 7 1850
囚心锁ツ
囚心锁ツ 2021-01-03 04:49

Google\'s GMail service does it because it integrates Google Talk -- and Etherpad (now typewith.me) made famous the system which is used by, for example, Google Wave. All su

7条回答
  •  攒了一身酷
    2021-01-03 05:37

    Javascript / Ajax allows you to send code to be executed on the client-side (that means, by the browser). Now if you e.g. define a loop which checks for new messages on server every 5 seconds, you can update the web-page "in-real-time" (plus the time for the server to process the req and send response), or similar. A practical example would be the RoR Prototype periodically_call_remote Ajax helper.

    Hope this helps!

提交回复
热议问题