Skip to content

Add SSE Support to graphQLSubscriptionsRoute with Configurable Transport Option #2105

Open
@cpoyatos1

Description

@cpoyatos1

Is your feature request related to a problem? Please explain.
The graphql-kotlin-ktor-server library has a built-in route function for WebSocket subscriptions (graphQLSubscriptionsRoute), but it doesn’t offer an easy way to handle Server-Sent Events (SSE). Having SSE support would be super helpful since it works over regular HTTP(S), making it easier to work with common tools like Identity & Access Proxies (e.g., Ory Oathkeeper), which usually need special setup to handle WebSockets.

Describe the solution you’d like
It would be great if the existing graphQLSubscriptionsRoute function could be updated to handle different types of connections, not just WebSockets. Maybe by adding a new option like transport: subscriptionTransport = SubscriptionTransport.WEBSOCKET, so we could also pick something like SubscriptionTransport.SSE when needed.

Describe alternatives you’ve considered
Building SSE support from scratch manually.

Additional context
This idea would keep everything under the same routing function, just with more flexibility. It would make it a lot easier to plug into HTTP-based security setups without needing extra complicated configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions