Interface GraphQLSubscriptionHooks
-
- All Implemented Interfaces:
public interface GraphQLSubscriptionHooks<T extends Object>GraphQL WS subscription lifecycle hooks. Allows API user to add custom callbacks on subscription events, e.g. to add validation, context tracking etc.
Inspired by Apollo Subscription Server Lifecycle Events. https://www.apollographql.com/docs/graphql-subscriptions/lifecycle-events/
-
-
Method Summary
Modifier and Type Method Description GraphQLContextonConnect(Object connectionParams, T session, GraphQLContext graphQLContext)Allows validation of connectionParams prior to starting the connection. UnitonOperation(String operationId, GraphQLRequest payload, T session, GraphQLContext graphQLContext)Called when the client executes a GraphQL operation. UnitonOperationComplete(String operationId, T session, GraphQLContext graphQLContext)Called when client unsubscribes UnitonDisconnect(T session, GraphQLContext graphQLContext)Called when the client disconnects -
-
Method Detail
-
onConnect
GraphQLContext onConnect(Object connectionParams, T session, GraphQLContext graphQLContext)
Allows validation of connectionParams prior to starting the connection. You can reject the connection by throwing an exception.
-
onOperation
Unit onOperation(String operationId, GraphQLRequest payload, T session, GraphQLContext graphQLContext)
Called when the client executes a GraphQL operation. The context here is what returned from onConnect earlier.
-
onOperationComplete
Unit onOperationComplete(String operationId, T session, GraphQLContext graphQLContext)
Called when client unsubscribes
-
onDisconnect
Unit onDisconnect(T session, GraphQLContext graphQLContext)
Called when the client disconnects
-
-
-
-