-
-
Notifications
You must be signed in to change notification settings - Fork 544
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multipart subscriptions (#3076)
* POC for multipart subscriptions * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix name * Progress * WIP * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Make test pass with django async * Attempt with FastAPI, type fixes * Improve code a bit * Improve naming * Run subs in execute * Workaround httpx for now * Aiohttp support * ASGI * Flask attempt * Support for sanic * Wip channels * Fix syntax * Fix various type issues * Pragma no cover * Initial feature table * Relative urls * Fix channels issue * Handle heartbeat * Remove type ignore * Add blank release file * Wrap response in payload * Update integrations * Improve how we check for content types * Run channels tests, even if they are broken * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix lint * Fix import * await cancelled tasks * Some refactoring * Remove stale comment * update type * Pass request down to creat multipart response * Fix tests with lowercase headers * Get support * Some release notes * Litestar support * Add docs * Remove subresponse * Fix check * Fix * Fix * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Lint * Sanic fix * Fixes * Update release file and add tweet file * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix tweet * Update tweet * Sub response support * Update docs --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
08db7f7
commit 68296e0
Showing
32 changed files
with
745 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Release type: minor | ||
|
||
This release adds support for multipart subscriptions in almost all[^1] of our | ||
http integrations! | ||
|
||
[Multipart subcriptions](https://www.apollographql.com/docs/router/executing-operations/subscription-multipart-protocol/) | ||
are a new protocol from Apollo GraphQL, built on the | ||
[Incremental Delivery over HTTP spec](https://github.com/graphql/graphql-over-http/blob/main/rfcs/IncrementalDelivery.md), | ||
which is also used for `@defer` and `@stream`. | ||
|
||
The main advantage of this protocol is that when using the Apollo Client | ||
libraries you don't need to install any additional dependency, but in future | ||
this feature should make it easier for us to implement `@defer` and `@stream` | ||
|
||
Also, this means that you don't need to use Django Channels for subscription, | ||
since this protocol is based on HTTP we don't need to use websockets. | ||
|
||
[^1]: Flask, Chalice and the sync Django integration don't support this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
🆕 Release $version is out! Thanks to $contributor for the PR 👏 | ||
|
||
Strawberry GraphQL now supports @apollographql's multipart subscriptions! 🎉 | ||
|
||
Get it here 👉 $release_url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: Multipart subscriptions | ||
--- | ||
|
||
# Multipart subscriptions | ||
|
||
Strawberry supports subscription over multipart responses. This is an | ||
[alternative protocol](https://www.apollographql.com/docs/router/executing-operations/subscription-multipart-protocol/) | ||
created by [Apollo](https://www.apollographql.com/) to support subscriptions | ||
over HTTP, and it is supported by default by Apollo Client. | ||
|
||
# Support | ||
|
||
We support multipart subscriptions out of the box in the following HTTP | ||
libraries: | ||
|
||
- Django (only in the Async view) | ||
- ASGI | ||
- Litestar | ||
- FastAPI | ||
- AioHTTP | ||
- Quart | ||
|
||
# Usage | ||
|
||
Multipart subscriptions are automatically enabled when using Subscription, so no | ||
additional configuration is required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# integrations | ||
|
||
WIP: | ||
|
||
| name | Supports sync | Supports async | Supports subscriptions via websockets | Supports subscriptions via multipart HTTP | Supports file uploads | Supports batch queries | | ||
| --------------------------- | ------------- | -------------------- | ------------------------------------- | ----------------------------------------- | --------------------- | ---------------------- | | ||
| [django](//django.md) | ✅ | ✅ (with Async view) | ❌ (use Channels for websockets) | ✅ (From Django 4.2) | ✅ | ❌ | | ||
| [starlette](//starlette.md) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | ||
| [aiohttp](//aiohttp.md) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | | ||
| [flask](//flask.md) | ✅ | ✅ | ❌ | ❌ | ✅ | ✅ | | ||
| [channels](//channels.md) | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | | ||
| [fastapi](//fastapi.md) | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.