websockets
websockets copied to clipboard
Future exception was never retrieved
I get this issue daily. I think it's due to a 1006 error interrupting a ping?
Future exception was never retrieved
future: <Future finished exception=ConnectionClosed('WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason') created at C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py:377>
source_traceback: Object created at (most recent call last):
File ".\tweetSpeedBuy_v3.py", line 475, in <module>
except KeyboardInterrupt:
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 555, in run_until_complete
self.run_forever()
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 523, in run_forever
self._run_once()
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 1750, in _run_once
handle._run()
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\protocol.py", line 984, in keepalive_ping
ping_waiter = yield from self.ping()
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\site-packages\websockets\protocol.py", line 600, in ping
return asyncio.shield(self.pings[data])
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\tasks.py", line 770, in shield
outer = loop.create_future()
File "C:\Users\eddie\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 377, in create_future
return futures.Future(loop=self)
websockets.exceptions.ConnectionClosed: WebSocket connection is closed: code = 1006 (connection closed abnormally [internal]), no reason
Might be related to #551.
Seems reasonable. For context, I am not calling the ping task myself, I only establish it in the connect() call
async with websockets.connect(full_websocket_address, ping_interval=30, ping_timeout=None) as websocket:
Indeed, this is #551, which I just fixed.
Guys, is there a whole example of how to use this code line? Will be appreciated.