Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Subscriptions HTTP Multipart Protocol #463

Open
andrewmcgivery opened this issue Feb 5, 2024 · 6 comments
Open

[Feature] Support Subscriptions HTTP Multipart Protocol #463

andrewmcgivery opened this issue Feb 5, 2024 · 6 comments
Labels
type: feature A new feature

Comments

@andrewmcgivery
Copy link

Apollo recently introduced HTTP callback protocol for GraphQL subscriptions which utilizes the HTTP Multipart protocol instead of websockets.

Apollo Client supports it out of the box and provides adapters for Relay and urql.

Would be awesome if this library supported it!

Some reference code from Apollo Client:

@leszekhanusz leszekhanusz added the type: feature A new feature label Feb 5, 2024
@leszekhanusz
Copy link
Collaborator

I think you're mixing two different things. The HTTP callback protocol that you first linked is different than the Multipart HTTP protocol (which is on the next page of the docs).

In the callback protocol, you have to create a server and send an url to the backend so that it could send answers to your own server.
In the Multipart protocol, you do an HTTP request which is long lived and will not close the connection but instead continue to send data as new events happen. There is no need for a server there.

I suppose you're interested in the Multipart protocol and not the callback protocol.

In that case, do you know a public backend which supports this protocol already that we could use to test this functionality?

@andrewmcgivery
Copy link
Author

Yep, you're correct about the differences... also for context, I'm a Solutions Architect at Apollo. 😄

I linked both for context but yes you're correct that what I'm interested in is the client portion, the Multipart protocol.

I don't know of a public backend currently... but I can help with testing by providing a private test repo (and adding you to it) and temporarily issuing an Apollo Key to a test graph.

@patrick91
Copy link
Member

@leszekhanusz @andrewmcgivery I'd be happy to help with this :)

If you need a backend for testing this I can make a an example with Strawberry (I have a PR open to add multipart support: strawberry-graphql/strawberry#3076)

@leszekhanusz
Copy link
Collaborator

Yep, you're correct about the differences... also for context, I'm a Solutions Architect at Apollo. 😄

Oops 😆

I don't know of a public backend currently... but I can help with testing by providing a private test repo (and adding you to it) and temporarily issuing an Apollo Key to a test graph.

That would be nice, but I would like to take this opportunity to ask if you could maybe propose in your organization to make a very simple public server to allow any user to test clients for GraphQL subscriptions. I think that would be a very nice gift to the GraphQL community.

With gql, we are using https://countries.trevorblades.com for most of our examples, but they dropped the websockets endpoint, so a public GraphQL backend which supports both the websocket and multipart protocol would be really nice. The actual schema could be something really simple like a subscription for a number counting to 10 with a 100ms interval for example. The bandwidth should be minimal as this serves no purpose except for a few tests. If that's not possible, no worries I'll use the private test repo.

@leszekhanusz
Copy link
Collaborator

If you need a backend for testing this I can make a an example with Strawberry (I have a PR open to add multipart support: strawberry-graphql/strawberry#3076)

That would be great!

Note for both of you: Is there a list somewhere of clients/servers supporting the multipart protocol in all languages? Something like the GraphQL file upload spec

@andrewmcgivery
Copy link
Author

Yep, you're correct about the differences... also for context, I'm a Solutions Architect at Apollo. 😄

Oops 😆

I don't know of a public backend currently... but I can help with testing by providing a private test repo (and adding you to it) and temporarily issuing an Apollo Key to a test graph.

That would be nice, but I would like to take this opportunity to ask if you could maybe propose in your organization to make a very simple public server to allow any user to test clients for GraphQL subscriptions. I think that would be a very nice gift to the GraphQL community.

With gql, we are using https://countries.trevorblades.com for most of our examples, but they dropped the websockets endpoint, so a public GraphQL backend which supports both the websocket and multipart protocol would be really nice. The actual schema could be something really simple like a subscription for a number counting to 10 with a 100ms interval for example. The bandwidth should be minimal as this serves no purpose except for a few tests. If that's not possible, no worries I'll use the private test repo.

I'll chat internally to see what we can do. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature A new feature
Projects
None yet
Development

No branches or pull requests

3 participants