[英]Autobahn websocket issue while running with twistd using tac file
我有一个使用autobahn WebSocket框架使用twisted实现的WebSocket服务器。 当程序使用python运行时,WebSocket服务器运行正常。 但是,如果我通过创建tac文件作为扭曲服务使用twistd服务器运行程序运行它,我在服务器中得到以下错误,而任何客户端尝试建立连接并且握手失败。
2015-12-08 07:17:56,022 - CRITICAL - twisted.publishToNewObserver() 154 Unhandled Error Traceback (most recent call last): File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/twisted/python/log.py", line 84, in callWithContext return context.call({ILogContext: newCtx}, func, *args, **kw) File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/twisted/python/context.py", line 118, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext return func(*args,**kw) File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 597, in _doReadOrWrite why = selectable.doRead() --- <exception caught here> --- File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 1067, in doRead protocol = self.factory.buildProtocol(self._buildAddr(addr)) File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/twisted/internet/protocol.py", line 135, in buildProtocol p = self.protocol() File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/autobahn/websocket/protocol.py", line 665, in __init__ self.is_closed = txaio.create_future() File "/opt/nrgi-ws/nrgi-ws-virtual-env/local/lib/python2.7/site-packages/txaio/_unframework.py", line 43, in _throw_usage_error "To use txaio, you must first select a framework " exceptions.RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_txaio()
我今天发现了同样的问题。 您应该将txaio降级到1.1.0版
这是我的点名单autobahn(0.10.9)autobahntestsuite(0.7.3)Twisted(15.4.0)txaio(1.1.0)zope.interface(4.1.3)
这个问题在我的Ubuntu系统中没有发生。 我在使用Machine Image Amazon Linux AMI的ec2实例中遇到了这个问题。 似乎txaio无法检测到可用的扭曲框架。 除了上面提到的@ helder.vasc之外的另一个修复是将框架指定为显式扭曲。 在tac文件中添加以下内容解决了以下问题:
import txaio txaio.use_twisted()
请注意天气,这是解决这个问题的完美方式。
你可以尝试使用高速公路大师吗? 这应该在那里修复,但还没有包含修复的版本(dd1cff8f9480a125e510108482bfaf5b9eedc916)。
您可以像这样安装master: pip install https://github.com/crossbario/autobahn-python/archive/master.zip
AutobahnTestSuite刚刚更新并纠正了这个问题:
autobahn(0.10.9)autobahntestsuite(0.7.4)Twisted(15.5.0)txaio(2.1.0)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.