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/

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      GraphQLContext onConnect(Object connectionParams, T session, GraphQLContext graphQLContext) Allows validation of connectionParams prior to starting the connection.
      Unit onOperation(String operationId, GraphQLRequest payload, T session, GraphQLContext graphQLContext) Called when the client executes a GraphQL operation.
      Unit onOperationComplete(String operationId, T session, GraphQLContext graphQLContext) Called when client unsubscribes
      Unit onDisconnect(T session, GraphQLContext graphQLContext) Called when the client disconnects
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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.

      • onDisconnect

         Unit onDisconnect(T session, GraphQLContext graphQLContext)

        Called when the client disconnects