python - 如何只使用tornado的websocket模块而不使用它的web server呢?
本文介绍了python - 如何只使用tornado的websocket模块而不使用它的web server呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
最近在做一个项目中要用到websocket来实时展示数据,但是项目用的web server是公司内部自己写的框架,不知道怎么把tornado的websocket集成到上面?
解决方案
Tornado提供了一个WSGIAdapter类,可以让Tornado运行在其他WSGI上,但是
官方中提到:
In WSGI mode asynchronous methods are not supported. This means that it is not possible to use AsyncHTTPClient, or the tornado.auth or tornado.websocket modules.
所以在其他WSGI上使用tornado的websocket功能估计是很困难的。
如果你不是一定要用tornado,我建议你可以看看这些websocket模块,特别是WebSocket-for-Python模块
https://github.com/vinta/awesome-python#websocket
这篇关于python - 如何只使用tornado的websocket模块而不使用它的web server呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文