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

Subscription with SSE #309

Closed
ruben-garciapariente opened this issue Feb 25, 2022 · 4 comments
Closed

Subscription with SSE #309

ruben-garciapariente opened this issue Feb 25, 2022 · 4 comments
Assignees
Labels
type: enhancement A general enhancement
Milestone

Comments

@ruben-garciapariente
Copy link

Are you planning to add support for subscriptions over Server-Side Event?

Many thanks & regards

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 25, 2022
@hantsy
Copy link
Contributor

hantsy commented Feb 25, 2022

Although there is no specification for SSE, I think it is the simple way to get subscription support in a Spring MVC project.

@rstoyanchev
Copy link
Contributor

No plans to support SSE as there is no spec. Yes it can be done, but SSE by itself is only a way to define messages, like WebSocket.

For example, there is no way to map error and completion signals from a Subscription Publisher. For error, you could create a final ExecutionResult and close the connection, but the client can't properly turn that into an error signal to the client side subscription Flux. By comparison GraphQL over WebSocket defines an error message and in the new GraphQlClient, subscriptions can end with an error signal. See the GraphQlTransport for executeSubscription. We cannot support that contract for SSE without a protocol like GraphQL over WebSocket but for SSE.

GraphQL for WebSocket also defines ping and pong messages which is important for connectivity issues with long running streams. For the time being, while there is no spec, we have no plans to support it.

@jma-9code
Copy link

It might be a good time to reconsider it.

For Websockets, Spring utilizes the specification found at https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md.

Regarding SSE, we've had a specification available for the past year at https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverSSE.md. (from the same guy who work on graphql-ws)

It appears that SSE offers several advantages for various use cases when compared to Websockets. Is it possible to consider its implementation in light of these new developments?

@rstoyanchev
Copy link
Contributor

Thanks for the pointer. Yes, we can add an option for SSE.

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

No branches or pull requests

6 participants