Fix websocket handler bug on Python3.5 with no uvloop
This commit is contained in:
parent
7cc02e84ed
commit
2f84cdd708
|
@ -206,7 +206,12 @@ class Sanic:
|
||||||
def response(handler):
|
def response(handler):
|
||||||
async def websocket_handler(request, *args, **kwargs):
|
async def websocket_handler(request, *args, **kwargs):
|
||||||
request.app = self
|
request.app = self
|
||||||
protocol = request.transport.get_protocol()
|
try:
|
||||||
|
protocol = request.transport.get_protocol()
|
||||||
|
except AttributeError:
|
||||||
|
# On Python3.5 the Transport classes in asyncio do not
|
||||||
|
# have a get_protocol() method as in uvloop
|
||||||
|
protocol = request.transport._protocol
|
||||||
ws = await protocol.websocket_handshake(request)
|
ws = await protocol.websocket_handshake(request)
|
||||||
|
|
||||||
# schedule the application handler
|
# schedule the application handler
|
||||||
|
|
Loading…
Reference in New Issue
Block a user