This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-03
Channels
- # beginners (7)
- # calva (25)
- # clerk (2)
- # clj-kondo (5)
- # clojure (42)
- # clojure-brasil (1)
- # clojure-europe (10)
- # clojure-nl (1)
- # clojure-norway (14)
- # clojure-uk (3)
- # conjure (6)
- # datahike (4)
- # datomic (3)
- # etaoin (4)
- # fulcro (6)
- # graalvm (7)
- # hoplon (9)
- # hyperfiddle (6)
- # introduce-yourself (2)
- # london-clojurians (1)
- # off-topic (22)
- # pedestal (5)
- # portal (12)
- # proletarian (1)
- # releases (1)
- # shadow-cljs (9)
- # vim (9)
I am trying to get SSE events working for the first time, and am encountering an error around content types I could use help with:
No matching content-type available {:supported-content-types #{application/json application/transit+msgpack application/transit+json application/edn}, :available-content-types (multipart/form-data), :header Accept}
I'm unsure how to inform Pedestal this is a text/event-stream or get it to be "happy" .. but setting the content type in a header doesn't seem to work. I.e., returning this from the (sse/start-event-stream ..) stream-ready fn.
{:body (stream-events response event-chan) ;; fixed one bug where those were reversed, did not help.
:headers {"Content-Type" "text/event-stream"}}
Stream-events is simple, takes a source chan and feeds it to the target chan:
(defn stream-events [source sink]
(async/go
(loop []
(let [event (async/<! source)]
(when (not= :done event)
(async/>! sink event)
(recur))))))
There's no chance you are attempting to stream a nil? core.async treats nil as roughly "this channel has closed".
It's possible I suppose, although I get a response from the same code in the repl. I'll add some logging to track that possibility.
Ofc, in the repl I'm not going through pedestals full stack. I haven't spent time to figure out how to get that working yet.
Yep, that is what's happening. Will chase that down. Thx!