Aymeric Augustin
Aymeric Augustin
It works for me. I suspect it's an issue with your mypy setup. ``` myk@mYk:websockets/src ‹main›$ cat issue1183.py import websockets.client reveal_type(websockets.client.WebSocketClientProtocol) myk@mYk:websockets/src ‹main›$ mypy issue1183.py issue1183.py:3: note: Revealed type is...
Wait, you're using pylance, not mypy. I don't know much about pylance. I still suspect that it's failing to import websocktes.
I will do some testing before reverting the conditional import mechanism. (FYI it's designed to provide an implementation on top of trio without making trio a hard dependency of websockets....
Thanks to PEP 690, I will be able drop the lazy imports mechanism when I drop support for Python < 3.12. Given that Python 3.7 is still supported and that...
@CaedenPH This works for me: I suspect your original problem was the same as this one (which I'm demonstrating with the standard library to rule out websockets): You need to...
Reopening to check if I can clarify the documentation further or make it easier to discover.
From the documentation of [serve()](https://websockets.readthedocs.io/en/stable/reference/server.html#starting-a-server): > Any other keyword arguments are passed the event loop’s [create_server()](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.create_server) method. So you can pass `reuse_address=True` or `reuse_port=True` to `websockets.server.serve()` and they will be...
I see a problem with your code though: I think it runs two servers. `serve()` starts a server and stops it when exiting the context manager. `serve_forever()` starts another server...
Reopening (at least) as a documentation issue to clarify that serve() and serve_forever() are mutually incompatible.
> asyncio's docs say that serve_forever can be called if the server is already listening for connections Indeed I was wrong; this doesn't create a duplicate server. > If it's...