Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chat demo not working in aiohttp 3 #2789

Closed
robinchew opened this issue Mar 3, 2018 · 5 comments
Closed

Chat demo not working in aiohttp 3 #2789

robinchew opened this issue Mar 3, 2018 · 5 comments
Labels

Comments

@robinchew
Copy link

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?

@robinchew
Copy link
Author

The poll demo also does not work

@samuelcolvin
Copy link
Member

This should probably be on https://github.com/aio-libs/aiohttp-demos.

The proper solution here is to add unit tests to that app and remember to run them (as we already do for other related projects) before major deploys.

@robinchew
Copy link
Author

https://github.com/aio-libs/aiohttp-demos gives the same error

@gyermolenko
Copy link
Contributor

gyermolenko commented Mar 4, 2018

This should probably be on https://github.com/aio-libs/aiohttp-demos

I also think so.
I'll try to fix it tomorrow and check with aiohttp v3

p.s. The app was created by @jettify if I'm not mistaken

@lock
Copy link

lock bot commented Oct 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a [new issue] for related bugs.
If you feel like there's important points made in this discussion, please include those exceprts into that [new issue].
[new issue]: https://github.com/aio-libs/aiohttp/issues/new

@lock lock bot added the outdated label Oct 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants