sunng87 / ring-jetty9-adapter

An enhanced version of jetty adapter for ring, with additional features like websockets, http/2 and http/3
Eclipse Public License 1.0
274 stars 49 forks source link

Server-sent events support #63

Open sunng87 opened 2 years ago

sunng87 commented 2 years ago

Attempt to add support for server-sent events(SSE) on current ring model, like how we supported websocket.

rawoke083 commented 2 years ago

Any progress on this ?

sunng87 commented 2 years ago

I did some early investigation that SSE may not require adapter level support. It can be implemented via a library in ring ecosystem, like https://github.com/bobby/ring-sse/

I don't have real-world use case for SSE at the moment. Could you please check if the library work for you?

rawoke083 commented 2 years ago

Thanks, I saw that library, it's 4 years since it's been last updated, also could not figure out how to hook it up to a normal ring-application. Once again there seems to be only cryptic code snippets. I've asked the author to provide a minimal working example 6 days ago, no joy this far.

Seems to be the common problem in Clojure, Either completely out of date libraries or these extreme short and cryptic code-snippets that should somehow be regarded as documentation or examples. :/

TimoKramer commented 1 year ago

https://github.com/kumarshantanu/ring-sse-middleware

lnostdal commented 1 year ago

I'm surprised SSE doesn't seem to work. Does other forms of streaming HTTP responses work?

edit: By the way, the original ring project is upgrading to Jetty 11 now: https://github.com/ring-clojure/ring/pull/481 ...still alpha, but SSE seems to work.

sunng87 commented 1 year ago

Did you see any error log, or error behavior with SSE on this adapter? I might be able to create a fix for that.

lnostdal commented 1 year ago

It seems to go silent, no error, and no HTTP response. Then after a while the connection closes.