From 01cd1485af65442820329f60725c4d44144d36cb Mon Sep 17 00:00:00 2001 From: Michael Lange Date: Mon, 30 Aug 2021 11:53:38 -0700 Subject: [PATCH] Mention the ndjson standard format the event stream uses Knowing this upfront is important when looking for common libraries to help consume events. --- website/content/api-docs/events.mdx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/website/content/api-docs/events.mdx b/website/content/api-docs/events.mdx index a64ce709e..cd0a696dc 100644 --- a/website/content/api-docs/events.mdx +++ b/website/content/api-docs/events.mdx @@ -11,8 +11,12 @@ The `/event/stream` endpoint is used to stream events generated by Nomad. ## Event Stream -This endpoint streams a servers backlog of events as well as new events as they occur. -The stream will be kept alive until the connection is closed. +This endpoint streams a server's backlog of events as well as new events as they occur. +The stream will be kept alive until the connection is closed. The format of the response +body will be valid [ndjson](http://ndjson.org/). This means splitting the streaming +response at every `\n` character will guarantee each message is a valid JSON object. +Note that each JSON object may include multiple events (high server activity) or no +events (heartbeating to keep the connection open). | Method | Path | Produces | | ------ | ------------------ | ------------------ |