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
This code streams the values 0,1,2,3,4,5… for ever.