In one of my API's I mostly return a result (let's say paged 50 results) as one whole in an json
array like so:
[{},{},{},{},{},...]
I was wondering if there are better ways of doing this over HTTP2 (as it has many new partial streaming features) with Go's HTTP server (using HTTPS in Gin for this project).
Maybe I could chunk every {}
result and send them as segments on a stream? How would the AJAX call in Angular or jQuery know that there's a new chunk delivered (newline or some character marker?)? And what call in the library could actually handle such a multi-promise (does that even exist? :P)? Could I benefit from the HTTP2 stream-features in some way to prevent multiple-connections from opening?
I'm kind of aiming to have the results nicely plop into the list as they come in.
UPDATE
Maybe it's easier to use Keep-Alive
header in some way to let's keep the connection open for for a certain amount of seconds to be able to stream over and fire many smaller requests/responses?