Skip to content

Websockets examples are not working with Python 3.10 #3

Description

@yyunikov

Examples in 6_asyncio_websockets are not working with Python 3.10.

This can be observed with 2 issues:

  1. New deprecation warnings appear as per https://docs.python.org/3/whatsnew/3.10.html [asyncio.get_event_loop()](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop) now emits a deprecation warning if there is no running event loop.. Should be fixed by changing this code:
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()

to something like:

loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(start_server)
loop.run_forever()
  1. Basic and advanced apps are not functioning anymore. Didn't look very close into the reason, but could be related.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions