-
Notifications
You must be signed in to change notification settings - Fork 538
Add support for defer and stream directives (feedback is welcome) #726
base: main
Are you sure you want to change the base?
Conversation
da0c17c
to
213d365
Compare
This PR is looking fantastic! locally with a simple express server its working great. with the demo schema resolvers I made, and a query such as the one below, I can mimic mixed rapid or high latency streams by setting a delay argument we have a PR that implements this branch in I figured out a way to make it actually update state with every multipart increment. in 2.0 this will be handled with a much more performant state management strategy, but for now it seems fine. we now have a (mostly) working netlify deploy preview, using a query like this: {
isTest
stream: streamable(delay: 500) @stream(initialCount: 2) {
text
}
anotherStream: streamable(delay: 200) @stream(initialCount: 0) {
text
}
} notice how it waits and then batches all the increments at the end so it looks like a normal, very delayed request? and if you increase the delay, the more it delays the whole request. what I'm guessing is that netlify's CDN is batching the multipart requests somehow? i can't seem to increase the delay to a point that changes this, so I wonder what else I'm missing. I used We added I apologize if this question is not relevant to the PR discussion, and if so can move this comment over to our PR! |
Hi @IvanGoncharov im working with @acao around getting defer/stream into GraphiQL and was wondering if you could do us a solid and cut a release under the current experimental tag (or whatever you feel) that includes 633ca8b. meros (used by graphiql now) depends on this behavior being present, as the timing of flushing chunks with boundaries is critical, largely based on latest "spec proposal" updates. |
This removes the need for `Content-Length`, and handles the boundaries such that the next boundary is flushed as soon as possible. References: - graphql/graphql-over-http#152 - fmg relay-tools/fetch-multipart-graphql#22 - [meros](https://github.com/maraisr/meros)
213d365
to
9acd264
Compare
This branch is being published to npm as
express-graphql@experimental-stream-defer
Continued from #583
References: