Can we achieve response streaming using an AWS ALB or NLB

566 Views Asked by At

We are building a flask application wherein for a specific request we want to be able to stream the response to the client. Something like this

@app.route("/time/")
def time():
    def streamer():
        while True:
            yield "<p>{}</p>".format(datetime.now())
            sleep(1)

return Response(streamer())

This does not work when we use an AWS ALB as the load balancer - the client is unable to read from the stream. Is this a limitation on the AWS ALB side? Should I consider using AWS NLB instead?

0

There are 0 best solutions below