The underlying http server we use (Simple) doesn’t support websockets yet. But streaming good-old server-sent events works very well.
To produce a stream of messages, we rely on the Java 8 Stream API.
Here's a sample
new WebServer(routes -> routes .get("/events", () -> Stream.iterate(0, (a) -> a + 1))) .start(9090);
This code streams the values 0,1,2,3,4,5… for ever.