To see more details on how to implement subscriptions in your schema, see the schema generator docs on executing subscriptions.
This page lists the
graphql-kotlin-spring-server specific features.
graphql-kotlin-spring-server provides automatic support for Kotlin
that supports existing
Publishers and relies on Kotlin reactive-streams interop to convert
Flow to a
We have implemented subscriptions in Spring WebSockets following the
graphql-ws subprotocol defined by Apollo.
This requires that your client send and parse messages in a specific format.
If you would like to implement your own subscription handler, you can provide a primary spring bean for
HandlerMapping that overrides the default one which sets the url for subscriptions to the Apollo subscription handler.
In line with the Apollo protocol, we have implemented hooks to execute functions at different stages of the connection lifecycle.
If you would like to implement your own subscription hooks, you can provide a primary spring bean for
ApolloSubscriptionHooks that overrides the default one which do not perform any actions.
Allows validation of connectionParams prior to starting the connection. You can reject the connection by throwing an exception. If you need to forward state to execution, update and return the GraphQLContext.
Called when the client executes a GraphQL operation. The context can not be updated here, it is read only.
Called when client's unsubscribes
Called when the client disconnects
You can see an example implementation of a
Subscription in the example app.