What are the advantages (or needs) of using tornad

2019-06-08 03:40发布

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.

2条回答
孤傲高冷的网名
2楼-- · 2019-06-08 04:19

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.

查看更多
看我几分像从前
3楼-- · 2019-06-08 04:40

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.

查看更多
登录 后发表回答