What mutex/locking/waiting mechanism to use when writing a Chat application with Tornado Web Framewo

Posted by user272973 on Stack Overflow See other posts from Stack Overflow or by user272973
Published on 2010-02-14T17:39:17Z Indexed on 2010/05/08 18:08 UTC
Read the original article Hit count: 230

Filed under:
|
|
|

We're implementing a Chat server using Tornado.

The premise is simple, a user makes open an HTTP ajax connection to the Tornado server, and the Tornado server answers only when a new message appears in the chat-room. Whenever the connection closes, regardless if a new message came in or an error/timeout occurred, the client reopens the connection.

Looking at Tornado, the question arises of what library can we use to allow us to have these calls wait on some central object that would signal them - A_NEW_MESSAGE_HAS_ARRIVED_ITS_TIME_TO_SEND_BACK_SOME_DATA.

To describe this in Win32 terms, each async call would be represented as a thread that would be hanging on a WaitForSingleObject(...) on some central Mutex/Event/etc.

We will be operating in a standard Python environment (Tornado), is there something built-in we can use, do we need an external library/server, is there something Tornado recommends?

Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about tornado