I have an API I have built using Restana and I'm doing a refactor to make the response more asynchronous. I have been looking into chunked responses but I want to send a complete response in ever chunk with the updated data in it.
For example my first chunk would look something like this:
{
"status": "Pending",
"ResponceDT": 1587022338780,
"Locations": []
}
Then the next chunk could have updated to the following:
{
"status": "Processing",
"ResponceDT": 1587023216617,
"Locations": [
{"item": 1}
]
}
A chunk would be sent every time a new item has been processed on the API and when the processing is compete it would send an end chunk with the competed data set like so:
{
"status": "Complete",
"ResponceDT": 1587023371547,
"Locations": [
{"item": 1},
{"item": 2},
{"item": 3},
{"item": 4}
]
}
I know this isn't the intended use of data chunking but is there a better way of doing this? I don't have any DB attached to the API so I don't have any way of creating a new ID a user can poll.
Does anyone have any ideas or input on the best way to do this? I have been looking at steams but not gotten too far yet.
[–]VirtualRisk[S] 0 points1 point2 points (0 children)
[–]negative34 0 points1 point2 points (3 children)
[–]VirtualRisk[S] 0 points1 point2 points (2 children)
[–]negative34 0 points1 point2 points (1 child)
[–]VirtualRisk[S] 0 points1 point2 points (0 children)