python 上的彗星
我对 python 网络编程还很陌生。
我有兴趣在浏览器上建立一个聊天室。 (对于原型)。 我非常了解 django,并且过去也做过一些扭曲的事情。
然后我遇到了轨道。 它的文档记录相当糟糕(我认为实际上不符合文档条件),但这些术语似乎经常出现:
- Orbited
- Twisted
- MorbidQ、ActiveQ 和基本上一堆 MessageQueue 技术
我在 Orbited 网站上做了一些示例,但他们似乎并没有真正解释一切如何协同工作。
我的问题是:
我一直在 [listen] 指令上看到 http://:9000 。根据他们的主要网站,“监听部分描述了 Orbited 应该用来接受浏览器连接的接口和端口。” AFAIK,标准浏览器使用端口 80 进行通信。我认为这个端口是供 Orbited.js 连接到服务器以实现彗星技术的?如果8000被封了怎么办? (就像学校/组织中的大多数防火墙后面一样)
我不断看到代理这个词。我不知道实际的代理如何适应这种框架组合
与扭曲和轨道的关系。 Orbited 是建立在扭曲之上的(如果我没记错的话)。那么为什么有这么多例子讨论在twisted之上使用orbited呢?为什么我首先需要扭曲?我可以在 nginx 上使用 Orbited 吗? (同样,搜索 nginx 和 Orbited 会得到包含“代理”一词的结果。这完全符合吗?)
关于 http://anirudhsanjeev.org/tutorialhow-to-django-comet-orbited-stomp-morbidq-jsio/,作者使用 xml-rpc 服务器。有人能真正解释为什么吗? (好吧,他说“你无法在 django 视图中启动反应堆发送/接收系统”,但是为什么我们首先需要在其中运行反应堆? 难道 Orbited 不是建立在twisted 之上的吗? 应该因此它不是有自己的反应堆吗?)
Morbidq 将自己描述为“Morbid 是一个 STOMP 发布/订阅服务器,绝对没有集群潜力。它支持发布/订阅主题,并作为单个节点运行。”为什么我们需要这个? Comet 不正是解决这样的问题吗?为什么我不断看到结合了一堆看似相似但实际上有明显区别的技术的教程?
我想做的就是构建一个简单的网络聊天应用程序。看到这个之后,我意识到也许使用orbited、twisted、morbidq和django等可能太麻烦了。 (当然,我计划使其可扩展)。
我看了龙卷风,它还可以,但在我看来,就社区而言有点小。除了允许非阻塞连接(我在 IRC 上了解到这一点)之外,它并没有真正实现 comet。我真的需要所有特殊的彗星技术吗?或者长轮询能让我满意吗? (对于一个简单的网络聊天应用程序)
大公司使用什么?大公司正在应用的事实上的彗星框架标准是什么? (比如 facebook、gtalk 和 twitter?)这些可以在 python 中使用吗?
对于任何问题的任何帮助将不胜感激。
I am pretty new to web programming in python.
I am interested to build a chat room on browser. (for prototype).
I know django pretty well and have done a bit of twisted in the past.
Then I came across orbited.
It's pretty badly documented (I don't think that actually qualifies for documentation anyway), but these terms seems to pop up quite frequently:
- Orbited
- Twisted
- MorbidQ, ActiveQ, and bascially a bunch of MessageQueue technologies
I did a few examples on the orbited website, but they somehow doesn't seem to explain really how everything works together.
My questions are:
I keep seeing http://:9000 on the [listen] directive. According to their main website, "The listen section describes the interfaces and ports Orbited should use to accept browser connections." AFAIK, standard browser uses port 80 to communicate. And I think this port is used for orbited.js to connect to the server for comet techniques? What happens if 8000 is blocked? (like behind most firewall in schools/organizations)
I keep seeing the word proxy. I do not know how an actual proxy fits within this combination of frameworks
The relationship with twisted and orbited. Orbited is built ON TOP OF twisted (if I am not wrong). Then why are there so many examples that discuss using orbited ON TOP of twisted? Why do I need twisted in the first place? Can I use orbited on nginx? (Again, searching for nginx and orbited results in results that have the word proxy in them. How does this fit at all?)
With regards to http://anirudhsanjeev.org/tutorialhow-to-django-comet-orbited-stomp-morbidq-jsio/, the author uses an xml-rpc server. Can someone actually explain why? (well he said that "you cannot start up a reactor send/receive system inside your django view", but why do we even need to run a reactor inside that in the first place? Isn't orbited built on top of twisted? Shouldn't it therefore have its own reactor?)
Morbidq describes itself as "Morbid is a STOMP publish/subscribe server with absolutely no potential to cluster. It supports publish/subscribe topics, and runs as a single node." Why do we need this? Doesn't Comet solve something exactly like this? why do I keep seeing tutorials that combine a bunch of technologies that are seemingly similar but really has clear distinction?
All I want to do is to build a simple webchat application. After seeing this, I realize that maybe using orbited and twisted and morbidq and django etc might be too troublesome. (Of course I am planning to make it scalable).
I looked at tornado, it's okay, but kind of small imo in terms of community. It doesn't really do comet except it allows non-blocking connections (I learned this on IRC). Do I really need all the special comet techniques, or will long polling satisfy me? (for a simple web chat application)
What are the big companies using? What's the standard defacto comet framework big companies are applying? (like facebook, gtalk, and twitter?) Are these available in python?
Any help on any question will be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看Alex Gaynor 关于 Python 和实时网络的 PyCon 演讲。
Check out Alex Gaynor's PyCon talk on Python and the real-time web.
好吧,我也在努力解决同样的问题,我想我可以回答一些问题,以供将来参考。
1) 如果对该端口的访问被阻止,您的网站将无法与 Orbited 通信。
2)代理有很多东西,把它想象成“重定向”,nginx充当代理。
3)orbited是建立在twisted之上的,但是它启动了自己的Twisted服务器。当与 Twisted 相关时,人们可能会谈论他们自己用 Twisted 而不是 Django 或其他构建的应用程序。
4)您可以避免 RPC 并通过 post/get 请求直接从 Django 脚本将消息放入队列中,他可能想构建更多...公司。
5)morbidQ是一个队列系统。彗星只是一个概念。框架是为了解决某些问题而构建的,可能还有其他类似的解决方案,但对于这种情况来说并不完整。我个人用rabbitMQ替换了morbidQ。
6)你是对的,可扩展性更多地取决于你的编码而不是你选择的技术。
7) 龙卷风很大。所有被认为特殊的东西都没有完整的浏览器支持,而长轮询则支持。
8)他们还没有开源他们的彗星解决方案。但这没什么大不了的。我认为 ruby 在这方面更加进化。
希望它对未来的网络冲浪者有所帮助!
Well I'm struggling with the same and I think I can answer some questions, for future reference.
1) if the acces to that port is blocked, your website won't be able to communicate with Orbited.
2) proxy is a lot of things, think of it as "redirection", nginx works as a proxy.
3) orbited is built upon twisted, but it starts its own Twisted server. when related to twisted people may talk about their own app built in Twisted instead of Django or others.
4) you can avoid the RPC and put messages in queue right from a Django script through a post/get request, he may wanted to build more... corporative.
5) morbidQ is a queue system. Comet is just a concept. Frameworks are built to solve certain problems, there may be other similar solutions, but not as complete for this situation. I personally replaced morbidQ with rabbitMQ.
6) you are right, the scalability depends more on your coding than the tech you chose.
7) tornado is great. everything considered special has no full browser support, while long polling does.
8) They never opensourced their comet solutions yet. But there is no big deal. I think ruby is more evolved in this matter.
hope it helps future web surfers!