Skip to content

Chat demo not working in aiohttp 3 #2789

Closed
@robinchew

Description

Long story short

Want to learn websockets with example code. There's a lack of simple and runnable example code on the net demonstrating websockets in python.

Expected behaviour

Server runs and page loads

Actual behaviour

Server runs but page fails to load with following error:

~/work/aiohttp/demos/chat$ ~/venv3/bin/python aiohttpdemo_chat/main.py 
DEBUG:asyncio:Using selector: EpollSelector
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
ERROR:aiohttp.server:Error handling request
Traceback (most recent call last):
  File "/home/robin/venv3/lib/python3.6/site-packages/aiohttp/web_protocol.py", line 381, in start
    resp = await self._request_handler(request)
  File "/home/robin/venv3/lib/python3.6/site-packages/aiohttp/web_app.py", line 310, in _handle
    resp = await handler(request)
  File "/home/robin/venv3/lib/python3.6/site-packages/aiohttpdemo_chat-0.0.1-py3.6.egg/aiohttpdemo_chat/views.py", line 15, in index
    ok, protocol = resp.can_start(request)
AttributeError: 'WebSocketResponse' object has no attribute 'can_start'

Steps to reproduce

Just run aiohttpdemo_chat/main.py

Your environment

archlinux, aiohttp 3.0.5 server?

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions