Chrome Server-Sent Event Parsing

1 · Nelson Elhage · Dec. 26, 2016, 11:23 p.m.
Server-sent events are a standard for web servers to stream a sequence of events to a browser over a single HTTP connection. You can view them as a simpler, unidirectional, alternative to websockets (that doesn’t require support from any middleboxes), or as an optimization over one-event-per-request longpolling. The wire format for an event consists of a number of newline-separated key-value pairs, in a simple key: value format. For instance, the documentation provides the example event: event: ...