I learned about Datastar through this podcast last year, and after reviewing the docs, I got excited about its interesting SSE support. SSE made more sense than WebSockets for some Unison Cloud use cases I had in mind. But the @unison/cloud library does not have SSE support because the underlying @unison/http library lacks it. I was thinking of working on the same, but somehow could not make it happen last year. Fresh year, new takes.

I released @kaychaks/http-streaming-server , a micro-library built on top of @unison/http that supports streaming responses, today.

@kaychaks/http-streaming-server | Unison Share
Explore, read docs about, and share Unison libraries
https://share.unison-lang.org/@kaychaks/http-streaming-server

It could stream bytes, UTF-8-encoded text, and, of course, server-sent events โ€“ all of that, along with regular @unison/http support for usual HTTP1.1 and WebSocket communication. The Routes and Handler types are also updated to support the new HttpResponseStream type.

There are Datastar-specific examples in the repository as well.

Next up, making it ready for Unison Cloud. And then all the streaming use cases ๐Ÿƒ๐Ÿผโ€โ™‚๏ธ