Simple Server-sent events example in Node.js/JavaScript

2 · Christian · May 11, 2021, 2:42 p.m.
With Server-sent events you are able to send one-directionial events to a web page. Here is an example of how I used this functionality in Minimal Analytics Context In Minimal Analytics I needed to send updates about live users active on this blog back to the dashboard available at s.cri.dev Here is how it looks This is a perfect use case for Server-sent Events. Below you’ll find example code to implement it yourself in a bare Node.js based HTTP server. All the code is available on in the Minim...