使用tac文件运行twistd时出现Autobahn WebSocket问题

2022-04-18 00:00:00 python twisted autobahn autobahnws

问题描述

我有一个使用autobahnWebSocket框架实现的WebSocket服务器。WebSocket服务器在运行该程序时运行良好。但是,如果我使用twistd服务器运行器通过创建TAC文件作为扭曲服务来运行此程序,当任何客户端尝试建立连接并且握手失败时,我在服务器中得到以下错误。

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

这是我的PIP清单 高速公路(0.10.9) AutobahnestSuite(0.7.3) 扭曲(15.4.0) Txaio(1.1.0) Zope.interface(4.1.3)

相关文章