How to stop StreamingHttpResponse in Django on Google Cloud Run?
We have integrated the GPT API in our Django application running on Google Cloud Run. When a user makes a request, we send them a response using StreamingHttpResponse
from django.http
, enabling real-time streaming.
However, we currently do not have a way for users to stop an ongoing StreamingHttpResponse. We are looking for a solution to terminate the stream early if needed—without using WebSockets and without relying on Redis or other services that require VPC connectors, as they are costly for us at the moment.
Is there a way to achieve this within our existing Google Cloud Run setup?