Hi guys
I am trying to implement Server Sent Event support in a small hobby project based on the http-kit server framework and compojure.
I am still quite new to clojure in general, so it may very well be that I am missing something obvious, but this SSE detail has me stumped.
What I have tried is to take inspiration from the
Eventual library for the SSE implementation (which is aimed at jetty). I have changed the Eventual implementation so that it uses the http-kit async-channel implementation for data transmission. What I am seeing is that everything seems to run without errors except for the fact that no data is being received at the EventSource in the browser.
If I allow the sse channel to close immediately after opening (which is pretty useless), the initial message is received at the browser side, but if I keep the connection open, nothing gets received.
Having had a look at the http-kit internals, my suspicion is that the socket doesn't get flushed and so all my attempts at communication are sitting in some buffer somewhere.
All SSE implementations I have looked at for other platforms have explicit calls to flush the socket buffers on the long lived connection after each message transmission.
Does anyone have any suggestions as to a better way to achieve SSE support in a http-kit based server? Or maybe ideas as to what I might be doing wrong?
Thanks in advance.
LOAS