websockets icon indicating copy to clipboard operation
websockets copied to clipboard

docs: Correct the example for "Starting a server" in the API reference

Open xuanzhi33 opened this issue 1 year ago • 2 comments

It seems that server.close() is not an async function, so I changed

await server.close()

to

server.close()
await server.wait_closed()

in the API reference.

xuanzhi33 avatar Feb 28 '24 09:02 xuanzhi33

Thank for you the fix — indeed close() isn't a coroutine: https://github.com/python-websockets/websockets/blob/e217458ef8b692e45ca6f66c5aeb7fad0aee97ee/src/websockets/legacy/server.py#L724

I'm going to check how I introduced this mistake and merge the fix.

aaugustin avatar Feb 28 '24 09:02 aaugustin

I found the same mistake in the FAQ and fixed it.

xuanzhi33 avatar Feb 28 '24 10:02 xuanzhi33