diff --git a/sanic/websocket.py b/sanic/websocket.py index 60092836..a2c7b81d 100644 --- a/sanic/websocket.py +++ b/sanic/websocket.py @@ -119,6 +119,9 @@ class WebSocketProtocol(HttpProtocol): read_limit=self.websocket_read_limit, write_limit=self.websocket_write_limit, ) + # Following two lines are required for websockets 8.x + self.websocket.is_client = False + self.websocket.side = "server" self.websocket.subprotocol = subprotocol self.websocket.connection_made(request.transport) self.websocket.connection_open() diff --git a/setup.py b/setup.py index 9d278fbf..5c60d087 100644 --- a/setup.py +++ b/setup.py @@ -80,7 +80,7 @@ requirements = [ uvloop, ujson, "aiofiles>=0.3.0", - "websockets>=7.0,<8.0", + "websockets>=7.0,<9.0", "multidict>=4.0,<5.0", "requests-async==0.5.0", ]