What are the advantages (or needs) of using tornado with Pusher for a Django application?

筅森魡賤 提交于 2019-12-08 08:24: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.


回答1:


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.




回答2:


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!