Description
Hello there! 👋
I'm the maintainer of Freddie, a Mercure hub implementation leveraging Framework X and react/http - its job is mostly to broadcast Server-Sent Events.
Whenever a new request comes up, the request handler subscribes to a Redis channel and drops messages into the response body as soon as they come up. Problem is, whenever the connection closes, I have no means to get notified of that event, as the Connection
object is kept internal by react/http. On my side, this leads to redis subscribers kept subscribed, and performance degradations over time.
Unsure if it would be crappy or legit, but an easy way to tackle this would be to inject the connection object inside the request, so that we could access it through something like $serverRequest->getAttribute('connection')
. That's what Symfony already does with its own Request system (prefixing attributes by an underscore to mark them internal). WDYT?