Skip to content

Support Defer and Stream Directives #1452

Open
@arnaud-lb

Description

@arnaud-lb

Hi,

The DeferStream RFC describes a mechanism to deliver some parts of a query response incrementally:

This proposal would introduce @stream and @defer directives which clients could use to communicate the relative priority of requested data to GraphQL implementations. Furthermore this proposal would enable GraphQL APIs to split requested data across multiple response payloads in order of priority. The goal of this proposal is to enable applications to reduce latency without increasing server cost or resource contention.

Quoting apollo-server:

These directives allow clients to specify that parts of an operation can be sent after an initial response, so that slower fields do not delay all other fields.

The RFC is still a working draft, but it's implemented by relay, graphql-js (PR), apollo-server (PR).

On the transport level, servers can use a multipart response: https://github.com/graphql/graphql-over-http/blob/main/rfcs/IncrementalDelivery.md

It would be nice if this library implemented DeferStream. This can considerably simplify some data fetching patterns.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions