ariadne
ariadne copied to clipboard
Closing a long running subscription - aclose() and GeneratorExit
In asgi.py I can see the call to aclose(); await subscriptions[operation_id].aclose()
So how do I catch this in my subscription source? This should generate a GeneratorExit exception. I can not figure out a way to catch that exception in my subscription source which would then signal my code to exit.
I don't know if this is possible with how GraphQL's query executor is structured, as disconnection goes down and just removes async generators without telling them their job is done.
Do you mind sharing your usecase for explicit cleanup in source on disconnection?
I am serving data for a limited period of time with my websocket. Is there a way to close websocket connection on ariadne's side, without getting a disconnection from user?