How does incoming mail notification on Gmail works?

前端 未结 4 626
无人共我
无人共我 2021-01-04 05:50

I\'m wondering how it\'s implemented in Gmail, that every time you receive e-mail, the list of mails is automatically refreshed. It looks like the server is sending some kin

4条回答
  •  無奈伤痛
    2021-01-04 06:36

    Dont know exactly which technoloy Gmail uses, but the concept is to open a channel - using reverse AJAX, comet or sprocket based techniques.

    Think of it as the client requesting the server for data, but the server does not return for one minute unless it has new mail. Using this technique, the client can almost show the results in a real time manner and it does not have to poll every 2 secs. Makes sense?

提交回复
热议问题