Changes to the incremental responses
Fixes: #203
Preface: This is my first exposure to working with these Node objects on the server side so I'm not entirely sure if what I've done is correct.
I changed the way the incremental responses are sent back to the client. In the issue I noted
for await (const chunk of httpGraphQLResponse.body.asyncIterator) {
body.push(chunk);
}
this await
is stopping the server from incrementally delivering the responses and instead they're all delivered at once.
These changes allow the responses to be streamed back instead of all at once.
The logs in the client now show
what is data? {book: {…}} false 12:22:18
what is data? {book: {…}} false 12:22:19
Where the second book: {}
has the deferred data and is delivered 1 second after the first in which the 1 second is hard coded in my project using this package.