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

Autobahn test needs updating #5606

Closed
Dreamsorcerer opened this issue Apr 11, 2021 · 2 comments · Fixed by #5637
Closed

Autobahn test needs updating #5606

Dreamsorcerer opened this issue Apr 11, 2021 · 2 comments · Fixed by #5637
Labels
bug good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/

Comments

@Dreamsorcerer
Copy link
Member

Dreamsorcerer commented Apr 11, 2021

The _make_handler() method was removed in this PR: #3939

But, is still used at: https://github.com/aio-libs/aiohttp/blob/master/tests/autobahn/server.py#L37

This needs updating, if anybody would like to take on this small task.

References to aiohttp.ws_connect() appear to also need updating:
https://github.com/aio-libs/aiohttp/blob/master/tests/autobahn/client.py#L9

@Dreamsorcerer Dreamsorcerer added good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/ labels Apr 17, 2021
@wfatherley
Copy link
Contributor

wfatherley commented Apr 20, 2021

For the server.py bugfix, is it sufficient to utilize web.run_app in conjunction with an on-shutdown signal, like so:

...

async def on_shutdown(app):
    for ws in set(app["websockets"]):
        await ws.close(code=WSCloseCode.GOING_AWAY, message="Server shutdown")


if __name__ == "__main__":
    logging.basicConfig(
        level=logging.DEBUG, format="%(asctime)s %(levelname)s %(message)s"
    )

    app = web.Application()
    app.router.add_route("GET", "/", wshandler)
    app.on_shutdown.append(on_shutdown)
    try:
        web.run_app(app)
    except KeyboardInterrupt:
        print("Server stopped at http://127.0.0.1:9001")

or will usage of an AppRunner be preferred?

@Dreamsorcerer
Copy link
Member Author

Dreamsorcerer commented Apr 20, 2021

At a quick glance, that looks good to me. Atleast, it makes more sense to me than the original code does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Good for newcomers Hacktoberfest We think it's good for https://hacktoberfest.digitalocean.com/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants