Amplify Toolbox
    Preparing search index...
    • Define a custom subscription to receive an event when a mutation is triggered

      Returns CustomOperation<
          {
              arguments: null;
              authorization: [];
              handlers: null;
              returnType: null;
              typeName: "Subscription";
          },
          "returns",
          "subscriptionCustomOperation",
      >

      a custom subscription

      // Subscribe to incoming messages
      receive: a.subscription()
      // subscribes to the 'publish' mutation
      .for(a.ref('publish'))
      // subscription handler to set custom filters
      .handler(a.handler.custom({entry: './receive.js'}))
      // authorization rules as to who can subscribe to the data
      .authorization(allow => [allow.publicApiKey()]),