websockets icon indicating copy to clipboard operation
websockets copied to clipboard

Close method is not working

Open FabianArango opened this issue 3 years ago • 1 comments

Hi !!!, i just started to use your module, everything is okey but when i try to close the server connection nothing happens, no error menssajes or output logs..., is this a bug ?? Here's an example of my code:

import asyncio
import websockets

async def echo(websocket):
    async for message in websocket:
        print(message)
       
        # if the message is equals to 'some' (it's just and example : D) we close the server
        if message == "some":
            await websocket.close()

async def main():
    async with websockets.serve(echo, "localhost", 8000):
        await asyncio.Future()  # run forever

asyncio.run(main())

FabianArango avatar Jun 14 '22 18:06 FabianArango

Can you enable debug logs? https://websockets.readthedocs.io/en/stable/topics/logging.html?highlight=debug%20logs#configure-logging

Then you should get logs.

aaugustin avatar Jun 15 '22 06:06 aaugustin

I don't have enough information to take action on this issue. Given the lack of updates in two months, I will close it.

aaugustin avatar Aug 17 '22 08:08 aaugustin