Implementation of the comet on the database side

This is more out of curiosity and “for future reference” than anything, but how is the comet implemented on the database side? I know that most implementations use long-lived HTTP requests to “wait” until data is available, but how is this done on the server side? How does the web server know when new data is available? Does he constantly check the database?

+2
source share
2 answers

Which database are you using? If it supports triggers that many RDBMSs execute in any form or form, then you might have a trigger event that actually tells the HTTP request to send the appropriate response.

Triggers eliminate the need for polling ... polling is usually not a good idea.

PostgreSQL seems to have pretty good support (even PL / Python).

+1
source

it is very application dependent. The most likely implementation is a kind of messaging system.

Most likely, your server-side code will consist of several parts:

  • multiple application servers that handle incoming requests,
  • a () , ,
  • -

, . . , , , (-)

, , . messages .

, , .

Rails Juggernaut, - . , Rails, push juggernaut , .

+1

Source: https://habr.com/ru/post/1726686/


All Articles