Edit this page

up.protocol X-Up-Events
HTTP header

The server may set this response header to emit events with the requested fragment update.

The header value is a JSON array. Each element in the array is a JSON object representing an event to be emitted on the document.

The object property { "type" } defines the event's type. Other properties become properties of the emitted event object.

Important

HTTP headers may only contain US-ASCII (7-bit) characters. If you have higher code points in a JSON value, you may encode those characters using Unicode escape sequences.

Example

Content-Type: text/html
X-Up-Events: [{ "type": "user:created", "id": 5012 }, { "type": "signup:completed" }]
...

<html>
  ...
</html>

Emitting an event on a layer

Instead of emitting an event on the document, the server may also choose to emit the event on the layer being updated. To do so, add a property { "layer": "current" } to the JSON object of an event:

Content-Type: text/html
X-Up-Events: [{ "type": "user:created", "name:" "foobar", "layer": "current" }]
...

<html>
  ...
</html>