Amplify JS API Documentation
    Preparing search index...
    • post(
          ctx: AmplifyContext,
          channel: string,
          event: DocumentType | DocumentType[],
          options?: EventsOptions,
      ): Promise<void | PublishedEvent[]>

      Parameters

      Returns Promise<void | PublishedEvent[]>

    • post(
          channel: string,
          event: DocumentType | DocumentType[],
          options?: EventsOptions,
      ): Promise<void | PublishedEvent[]>
      Experimental

      API may change in future versions

      Publish events to a channel via HTTP request

      Parameters

      • channel: string

        channel path; <namespace>/<channel>

      • event: DocumentType | DocumentType[]

        JSON-serializable value or an array of values

      • Optionaloptions: EventsOptions

        request overrides: authMode, authToken

      Returns Promise<void | PublishedEvent[]>

      void on success

      await events.post("default/channel", { some: "event" })
      
      // event batching
      await events.post("default/channel", [{ some: "event" }, { some: "event2" }])
      // authMode override
      await events.post("default/channel", { some: "event" }, { authMode: "userPool" })
      // with explicit context
      await events.post(ctx, "default/channel", { some: "event" })

      on error