Skip to content
Advertisement

How to detect closed websocket in asyncio.gather(*tasks)

I have a list of asyncio tasks which contains with connecting,handshaking and receiving data from a websocket. This process is running correctly but sometimes the connection of one of the websocket (or maybe all of them) is closed. How can I detect and make a new conncetion to the closed one?

Here is the code which I use:

JavaScript

According to the below line, each task is specified with a name:

JavaScript

So each task can be detected. How can I use this feature to detect closed websocket.

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement