It's not very ergonomic right now, though technically possible.
There were a few approaches discussed in the Discord. Just going to copy them for visibility.
Messages
did a little thinking on potential APIs for this... i think what i'm going to be able to provide would be pretty minimal, i.e. you're kind of on your own. i think it's unfortunately a bit necessary due to how it works. but my initial thought was something like:
let assert Ok(sse_connection) =
mist.start_sse(conn, response.new() |> response.add_header(...)) // dunno if headers are valid
// this is where you'd have to do all the heavy lifting to get whatever data you need...
// but i'm not sure there's another way
let resp = mist.send_event(sse_connection, data) // -> Result(Nil, ..)
// if resp is Error there was some issue with the socket, so you shouldn't try to send any more
mist.end_events(sse_connection)
i slept like shit so my brain is not firing on all cylinders rn... i just kinda skimmed some documentation about SSEs. there seems to be stuff like some "retry window" on the response, and probably some other stuff. but i think this would work?
i could try to do something like the websocket api like you mentioned, but right now that's annoying because i have to spawn a whole separate process for that... which kinda sucks
that is likely a better api though?
It's not very ergonomic right now, though technically possible.
There were a few approaches discussed in the Discord. Just going to copy them for visibility.
Messages
did a little thinking on potential APIs for this... i think what i'm going to be able to provide would be pretty minimal, i.e. you're kind of on your own. i think it's unfortunately a bit necessary due to how it works. but my initial thought was something like:
i slept like shit so my brain is not firing on all cylinders rn... i just kinda skimmed some documentation about SSEs. there seems to be stuff like some "retry window" on the response, and probably some other stuff. but i think this would work?
i could try to do something like the websocket api like you mentioned, but right now that's annoying because i have to spawn a whole separate process for that... which kinda sucks that is likely a better api though?