question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add experimental support for @defer, @stream, and @live

See original GitHub issue

I’ve just completed implementation of the three new directives mentioned in the GraphQL Futures talk in GraphQL-Go: https://gist.github.com/paralin/f6891bd30eb96e91fba628096af3278c

I now need to enable Apollo-Client to understand these responses.

  • A “query” now has a stream of responses (like a subscription) and will need a new NetworkInterface type to enable this kind of streaming transport.
  • The “query” ends when the remote server closes the result channel. It’s up to the network interface to understand when this happens and communicate it back to Apollo.
  • Any query, even ones that do not use @stream, @defer, or @live can be sent over a streaming channel in the same way. If a query does not require returning data at a later time, the server will just immediately close the channel after returning the initial result.
  • Initial result looks identical to how Apollo currently receives results, with the exception of the lack of fields that are deferred in the initial response (those come in later)
  • The field path looks like ["regions", 0, "status"] and comes in in extensions.path.

These features are obviously experimental, but I’ve been able to build a real proof of concept of the server end of this in just a couple of days. I’m interested to now get it working properly with Apollo.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:3
  • Comments:33 (15 by maintainers)

github_iconTop GitHub Comments

8reactions
Akryumcommented, Apr 22, 2017

Any progress on supporting @defer on apollo? 😄

6reactions
stubailocommented, Aug 24, 2017

I think this is a good thing to reopen - part of the work for #1941 (Apollo Client 2.0) is supporting multiple results for the same query, which will make supporting @live and @defer pretty easy!

Read more comments on GitHub >

github_iconTop Results From Across the Web

New features in GraphQL: Batch, defer, stream, live, and ...
There is cool stuff to experiment with: I'm really excited to experiment with these features in Apollo. Since Apollo includes client and server ......
Read more >
Defer and Stream Directives in GraphQL - YouTube
Defer and Stream Directives in GraphQL with Rob Richard, Sr Director, Front-End Engineering at 1stdibs, and Liliana Matos, Director, ...
Read more >
Adding @defer and @stream to Absinthe - Elixir Forum
So I've got some use-cases that would be made much simpler if Absinthe supported the (not yet standardised) @defer and @stream directives ...
Read more >
Improving Latency with @defer and @stream Directives
We have released experimental versions of GraphQL.js and express-graphql . They are published to npm under graphql@experimental-stream-defer ...
Read more >
Experimental decorators warning in TypeScript compilation
I've to add the following in the settings.json file of vscode to remove the warning. "javascript.implicitProjectConfig.experimentalDecorators": true.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found