ariadne icon indicating copy to clipboard operation
ariadne copied to clipboard

Closing a long running subscription - aclose() and GeneratorExit

Open jonsmirl opened this issue 3 years ago • 2 comments

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.

jonsmirl avatar Dec 22 '21 20:12 jonsmirl

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?

rafalp avatar Jan 12 '22 16:01 rafalp

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?

shyos avatar May 09 '22 00:05 shyos