maxpowel / crypto_com_client

Apache License 2.0
16 stars 1 forks source link

no close frame received or sent #8

Open Cacti2333 opened 2 weeks ago

Cacti2333 commented 2 weeks ago

Hello, thanks for all the work that you've done.

I'm using your script on Linux and after some time of receiving order book, I get the exception "no close frame received or sent".

Not sure why this happens and I'm not able to stop the execution to re-run the script to start over.

try:
        loop = asyncio.new_event_loop()
        loop.run_until_complete(ASYNC_FUNCTION_NAME)
    except KeyboardInterrupt:
        print("KeyboardInterrupt")
    except Exception as error:
        print(f"CLI Exception {error=}")
    finally:
        loop.close()

With regards

maxpowel commented 5 days ago

Hello, this error is caused by an abrupt connection close. The conection was closed by the remote but no "connection close" frame was received.

I can try to add a reconnection functionality but of course the program should at least exit with error and not keep running but doing nothing.

I will add a functionality to raise to the top level program this error (and if not handled, the aplication will end with error). Is this ok for you?

Cacti2333 commented 4 days ago

Thank you so much @maxpowel

I will add a functionality to raise to the top level program this error (and if not handled, the aplication will end with error). Is this ok for you?

This would be amazing. I should also mention that the above code works and catches the exception but I would appreciate it if you could make necessary changes to raise the exception so that people simply can catch it. (I am not sure why I wasn't able to catch it in other types of Asyncio loops and run.

Thanks in advance