python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

How to handle ThreadedWebsocketManager exceptions

Open doubler137 opened this issue 3 years ago • 5 comments

Describe the bug when connection drops for some reason, i receive the exception on the black screen but i can't catch it.

To Reproduce turn of your wifi while running ThreadedWebsocketManager socket stream.

How can I handle this kind of exceptions so that my script restarts after receiving this exception. I think this is related to the threading.

doubler137 avatar May 19 '21 13:05 doubler137

I have the same issues - when there's an error, the docs say that the manager will call the callback with an error message. It doesn't call the callback again and just keeps running. I don't even receive an exception.

jacksoncd avatar May 19 '21 21:05 jacksoncd

There's some issue running the websockets manager inside docker(official python image) and doesn't report any problem it just keep running forever

marianocarrazana avatar May 20 '21 03:05 marianocarrazana

i dont think we are having the same issue guys. When the below code comes to an error, it will show the error on the screen but i can't catch it to handle it if i wrap it with a try except

bm = ThreadedWebsocketManager(API_KEY, API_SECRET) bm.start() bm.start_kline_socket(callback=handle_socket_message, symbol=symbol, interval=Client.KLINE_INTERVAL_5MINUTE)

doubler137 avatar May 20 '21 05:05 doubler137

Same issue here. When running ThreadedWebsocketManager, if I turn off the internet, I get a websocket 1006 error logged on the screen, but there is no error message sent to the callback, so it's impossible to catch the error in order to reset the socket. Then, when I turn on the internet, the socket thread is already killed and it does not reconnect anymore.

AndresRzCh avatar Aug 25 '21 10:08 AndresRzCh

Any workaround for this problem?

AminSaqi avatar Aug 23 '22 12:08 AminSaqi

Still any update?

sinaqahremani avatar Oct 18 '22 11:10 sinaqahremani