I a webserver that receives request, scrapes some data into a list and returns them back to the client. The problem is that it would take much time to scrape the data .Say 120seconds. So i thought about breaking it down into 10s of responses so more reponses will be added as the user scrolls down. This then raises a problem , because the server needs to keep check of the current data it has to return to a client . I wanted to use websockets but It seems like websockets will broadcast to all clients. I only need a way to send data in form of a stream where the client will contineously request for data. Example:
@app.get("/get_data")
def get_data():
for data in datas:
yield data
Please if this is possible in either flask or fastapi I would love to know, if not then how possible it is to send data to a specific client using websockets while keeping track of the last data sent to the client. Also give tutorials ,references and articles if any.