Events
Server-Sent Events emitted on GET /events, and how to subscribe to individual event types
Every event consumed from agrirouter flows through the GET /events Server-Sent Events stream. This page catalogs each event type, its data: payload fields, and a sample frame as it appears on the wire.
Each event is a pair of lines:
event: <EVENT_TYPE>
data: <single-line JSON object>The data value is a JSON object. Every payload carries an event_type discriminator field whose value matches the preceding event: line. See the SSE specification for the wire format.
Subscribe to a subset of event types with the event_types query parameter on GET /events, for example ?event_types=MESSAGE_RECEIVED&event_types=FILE_RECEIVED. If omitted, all event types stream on the connection.
Two families of events
The events on the stream fall into two groups:
- Data-flow events describe messages and files arriving on your endpoints' feeds:
MESSAGE_RECEIVEDandFILE_RECEIVED. - Tenant-state events describe changes to the access and visibility your application has across tenants:
AUTHORIZATION_ADDED,AUTHORIZATION_REVOKED,ENDPOINT_DELETED, andENDPOINTS_LIST_CHANGED. Use them to keep your local view of authorized tenants and visible endpoints in sync without polling.
Event types
MESSAGE_RECEIVED
A non-chunked message arrived in the feed of one of the application's endpoints.
FILE_RECEIVED
agrirouter has finished reassembling a chunked payload and it is ready to consume as a single file.
ENDPOINT_DELETED
One of the application's endpoints was deleted. Clean up any local state tied to it.
ENDPOINTS_LIST_CHANGED
The set of endpoints visible to the application in a tenant changed, or a visible endpoint's capabilities or routes changed.
AUTHORIZATION_ADDED
A user granted the application a new authorization for a tenant.
AUTHORIZATION_REVOKED
A user revoked the application's authorization for a tenant. Access to the tenant is already gone when the event is delivered.