Install using clojars deps coordinates:
This library already depends on the core SDK lib.
This library provides an implementation of the
starfederation.datastar.clojure.protocols/SSEGenerator for the Aleph adapter.
patch-elements, etc...) return manifold deferred containing a boolean instead
of returning the boolean itselfon-open callback from the ->sse-response is called synchronously.
In other words the ring response won't be sent to the client until this callback is done.
To circumvent this you can offload work to a future/vthread from here. That way
the callback ends, the initial SSE response (status + headers) is sent and the SSE stream
opens immediately.important
Just to be sure, be really careful not to block in the on-open callback. This is the
main difference from the Ring and Http-kit implementations.
Aleph detects closed connections by itself. When it does the on-close
callback of ->sse-response will be called.
The connection stays alive until the client or your code explicitly closes it server side regardless of the ring API (sync vs async) you are using.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |