Media Type Registry

Server-Sent Events: Event streams for SSE

Media Type(s):

text/event-stream (not IANA-registered)WHATWG HTML §Server-Sent Events, WHATWG HTML §IANA

OAS References:

Sequential Media Types (Media Type Object)
Special Considerations for Server-Sent Events (Media Type Object)
Server-Sent Event Stream (Examples) (Media Type Object)

Summary

Server-Sent Events use the text/event-stream media type to stream events. Each event is modeled as if it were a JSON object with fields and types as given in the SSE specification, ignoring comments (fields with an empty string for the name) and any variations in serialization that represent the same event content.

Remarks

A complete event stream can be modeled as if it were a JSON array of such objects in the schema field, but the more common use case is to use the itemSchema field to apply the same schema to each event as it is streamed.

Note that application-level conventions regarding event usage (e.g. “sentinel events”) that are not part of the media type specification are not modeled, as the OAS does not currently (as of OAS v3.2) work with semantics above the media type level.