Re: How to implement a cherrypy server with long-polling enabled path?
Tim Roberts <[email protected]> Wed, 18 Dec 2019 20:54:29 -0800
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Message-ID | <[email protected]> |
On Dec 17, 2019, at 6:23 PM, =E5=8C=97=E7=BE=8E38fule <38fule.north.america= @gmail.com> wrote: >=20 > I am a newbie in cherrypy. I've done some research on google but didn't g= et much helpful information. > Could someone please point out if cherrypy allows me to write a simple se= rver that has long-polling enabled path? > The scenario is like: whenever the database on backend has some updated i= nformation, it sends signals to the frontend to updates all relevant displa= y accordingly. >=20 > Is this achievable using cherrypy? Or I will need tornado-like framework?= Could someone also point out a newbie-friendly tutorial for this purpose? = Thanks. That=E2=80=99s just not how HTTP works. The right way to do this is =E2=80= =9Cpull model=E2=80=9D: have the clients (that is, the browsers) poll for = the new data. It=E2=80=99s possible to use WebSockets to set up a persiste= nt connection to a server, but you=E2=80=99d want another TCP server, not a= n HTTP server. HTTP is fire and forget. One request, one response, close = the socket. General TCP servers are basically trivial to write in Python. =E2=80=94=20 Tim Roberts, [email protected] Providenza & Boekelheide, Inc. --=20 You received this message because you are subscribed to the Google Groups "= cherrypy-users" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To view this discussion on the web visit https://groups.google.com/d/msgid/= cherrypy-users/920E0DDC-CDCA-40E7-B342-1ED7042F5508%40probo.com.