AWS AppSync Events concepts
Before you get started, review the following topics to help you understand the fundamental concepts of AWS AppSync Events.
API
An Event API provides real-time capabilities by enabling you to publish events over HTTP and subscribe to events over WebSockets. An Event API has one or more channel namespaces that define the capabilities and behavior of channels that events can be addressed to. To learn more about configuring an API, see Configuring authorization and authentication to secure Event APIs and Configuring custom domain names for Event APIs.
Event
An event is a JSON-formatted unit of data that can be published to channels on your API and received by clients that are interested in that channel. Events can contain any arbitrary data you want to transmit in real-time, such as user actions, data updates, system notifications, or sensor readings. Events are designed to be lightweight and efficient, with a maximum size of 240 KB per event.
Channel
Channels are the routing mechanism for directing events from publishers to subscribers. You can think of a channel as a "topic" or "subject" that represents a stream of related events. Clients subscribe to channels in order to receive events published to those channels in real-time. Channels are ephemeral and can be created on-demand.
Channel namespace
A channel namespace (or just namespace for short) provides a way to define the
capabilities and behaviors of the channels associated with it. Each namespace has a name. This name represents the starting segment (the prefix) of a channel path. Any
channel where the first segment in the path matches the name of a namespace, belongs to
that namespace. For example, any channel with a first segment of
default
, such as /default/messages
,
/default/greetings
, and /default/inbox/user
belongs to the namespace named default
. To learn more about
namespaces, see Understanding channel namespaces.
Event handler
An event handler is a function defined in a namespace. An event handler is a custom function to process published events before they are broadcast to subscribers. A event handler can also be used to process subscription requests when clients try to subscribe to a channel.
Publishing
Publishing is the act of sending a batch of events to your Event API. Published events can be broadcasted to subscribed clients. Publish is done over HTTP.
Subscribing
Subscribing is the act of listening for events on a specific channel or subset of channels over an Event API WebSocket. Clients that subscribe can receive broadcast events in real-time. Clients can establish multiple subscriptions over a single WebSocket.