Puma dating code
Generally, this means you must protect concurrent access to shared resources (I/O, memory, etc) via Mutexes. SSE's are long running streams of data -- reconnections would make the technology no better than AJAX polling.My application is already pretty chatty with an SSE, I certainly don't want to increase this by using a broken SSE implementation...Puma detects that the connection has closed and it just kills the thread associated with it -- which kills the loop. I inspected the code, and it seems that sinatra doesn't "respect" the official rack hijack API.
Each forked process (worker) allows you to spawn multiple threads.
I am hoping I figure out a better way to detect disconnects, so that the memory space of that connections event queue can be freed right away.
@tylermauthe already read the solution and played around with it.
I'll post what I've learned below -- it may be more than you need to know but hopefully other people can find this a useful primer in the future.
Long story short, building SSEs in Puma requires a fairly decent understanding of concurrency.