We are a small team starting to plan how to develop a chat service in Django using Pusher to push the messages in real time.
So far we understand that we need an asynchronous way of pushing the messages to the Android and web browsers clients and we've chosen a hosted solution (Pusher) instead of implementing our own, probably using sockjs and tornado. We thought we didn't need Tornado for anything now that we have Pusher!.
In the Python module documentation (https://github.com/pusher/pusher_client_python) there is only small mention to Django, there is however a Tornado section which says:"To use the Tornado web server to trigger events... ". So we wonder why would we need or what use does it have to use Tornado to Trigger the events from our server to Pusher.
Thanks in advance.
The only scenario I can imagine is when you need to trigger multiple messages at once, then tornado being asynchronous is obviously more beneficial then django (or any other synchronous web framework), since the latter would have to trigger message and wait for response every time.
The linked document just means that if you are using both Pusher and Tornado, you should do this extra bit of configuration to make Pusher work nicely with Tornado's non-blocking model. Frameworks that use synchronous concurrency don't need any extra work so they don't need to be mentioned specifically in the docs. You can continue to use Tornado or Django (or Flask, etc) depending on your preferences and the needs of your application.
来源:https://stackoverflow.com/questions/19146851/what-are-the-advantages-or-needs-of-using-tornado-with-pusher-for-a-django-app