We migrated from channels 0.8 to 0.9.x (currently on master).
(So maybe I missed sth. that changed from 0.8 to 0.9.x)
Daphne is updated and on master too.
Django 1.9.4
Python 3.4.3
runserver with --noasgi works as expected.
but with asgi every websocket connection results in:
File "/usr/local/lib/python3.4/dist-packages/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python3.4/dist-packages/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python3.4/dist-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python3.4/dist-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
--- <exception caught here> ---
File "/usr/local/lib/python3.4/dist-packages/twisted/internet/posixbase.py", line 597, in _doReadOrWrite
why = selectable.doRead()
File "/usr/local/lib/python3.4/dist-packages/twisted/internet/tcp.py", line 209, in doRead
return self._dataReceived(data)
File "/usr/local/lib/python3.4/dist-packages/twisted/internet/tcp.py", line 215, in _dataReceived
rval = self.protocol.dataReceived(data)
File "/usr/local/lib/python3.4/dist-packages/twisted/protocols/basic.py", line 571, in dataReceived
why = self.lineReceived(line)
File "/usr/local/lib/python3.4/dist-packages/twisted/web/http.py", line 1720, in lineReceived
self.allContentReceived()
File "/usr/local/lib/python3.4/dist-packages/twisted/web/http.py", line 1799, in allContentReceived
req.requestReceived(command, path, version)
File "/usr/local/lib/python3.4/dist-packages/twisted/web/http.py", line 832, in requestReceived
self.process()
File "/usr/local/lib/python3.4/dist-packages/daphne/http_protocol.py", line 67, in process
protocol = self.factory.ws_factory.buildProtocol(self.transport.getPeer())
File "/usr/local/lib/python3.4/dist-packages/twisted/internet/protocol.py", line 135, in buildProtocol
p = self.protocol()
File "/usr/local/lib/python3.4/dist-packages/autobahn/websocket/protocol.py", line 665, in __init__
self.is_closed = txaio.create_future()
File "/usr/local/lib/python3.4/dist-packages/txaio/_unframework.py", line 43, in _throw_usage_error
"To use txaio, you must first select a framework "
builtins.RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_asyncio()
How can we set use_twisted() or use_asyncio() ?
Daphne seems to require twisted. Why use twisted if there is asyncio (py3.4+)?
Daphne uses twisted because I'd have to write two separate codebases for asyncio and twisted otherwise so I could support 2.7 as well, which I do plan to do eventually, but it should work just fine for now; I only run on 3.4 when I'm developing channels and I've never seen this.
What version of Twisted and autobahn do you have locally?
We have another project where this exception does not appear. It uses autobahn 0.12.1. I'm checking if upgrading autobahn helps.
Yeah, I'm on 0.12.1 locally - let me know if that fixes it and I can add an explicit version requirement.
Works just fine with autobahn 0.12.1.
Hmm, daphne already depends on autobahn>=0.12 - did you upgrade using pip?
The project runs in a docker container and all requirements are installed using pip. The requirements.txt had autobahn pinned to 0.10.9.
Ah, okay, that explains it - I'll close this then, since the package version declarations are accurate.
Most helpful comment
Ah, okay, that explains it - I'll close this then, since the package version declarations are accurate.