The Eventsource interface is web content's interface to server-sent events. An Eventsource instance offers a persistent connection to an HTTP server, which sends events in text/event-stream format. Eventsources are mostly used as workflow triggers. You're adding an event source when you add a new app-based trigger to your workflow.
For two reasons, event sources run as independent resources from workflows:
The EventSource() constructor returns a newly-created EventSource, which represents a remote resource. The basic syntax of EventSource() is given below.
eventSource = new EventSource(url, configuration);
Example:
var evtSource = new EventSource('sse.php');
var eventList = document.querySelector('ul');
evtSource.onmessage = function (e) {
var newElement = document.createElement('li');
newElement.textContent = 'message: ' + e.data;
eventList.appendChild(newElement);
};
Data is collected from apps and services such as Github, Twitter, and Google Calendar, and then emitted as individual events via event sources. The API or SSE interfaces can be used to access these events, which trigger associated workflows.
The event source employs webhooks or another mechanism for real-time data delivery if the service supports them. Google Sheets, for example, offers webhooks, which allow event sources in Google Sheets to send out updates quickly.
Pipedream monitors the API for changes every few minutes if a service doesn't allow real-time event delivery, and emits events as the API generates them. We poll their API for new records added to a table because Airtable doesn't support webhooks.
The Pipedream UI and CLI can both be used to create event sources.
To create a new event source, go to https://pipedream.com/sources and select the New + button in the top right corner. A list of sources linked to apps (such as Twitter and Github) and generic interfaces will appear (like HTTP).
Select your source, and you'll be prompted to link any necessary accounts (the Twitter source, for example, requires you to provide Pipedream access to your Twitter account), as well as enter the values for any source-specific configuration options.
You can use a source to trigger Pipedream workflows or consume its events using Pipedream's APIs once you've created it.
This will open an interactive menu that will ask you to choose a source. Once you've chosen a source, you'll be prompted to link any required accounts (for example, the Twitter source requires you to provide Pipedream access to your Twitter account) and input the values for any source-specific configuration options.
You can use a source to trigger Pipedream workflows or consume its events using Pipedream's APIs once you've created it.
The events for a source can be found in the source's UI, under the Events section.
A Pipedream process can also be started whenever your source produces a new event. This allows you to create workflows for every new tweet, RSS feed item, and more.
Finally, there are a couple of ways to consume events programmatically outside of the Pipedream platform: