athena icon indicating copy to clipboard operation
athena copied to clipboard

Mercure Protocol integration

Open AndiLavera opened this issue 3 years ago • 2 comments

Currently Athena::Routing::Response lacks support for websockets. Upon some investigation, HTTP::Server::Response#update_handler needs to be set & Athena::Routing::Response does not currently support that.

AndiLavera avatar May 07 '21 14:05 AndiLavera

So unfortunately after thinking about this for a while, I've come to realize that websockets just do not fit into the overall design of Athena. https://github.com/athena-framework/athena/issues/129 could be used as a pretty decent solution in allowing usage of the stdlib's/external shard's HTTP::Handler websocket implementation without needing any changes to Athena.

The main downside of that is the integration between Athena and your websocket logic would be lacking (no DI/abstractions). Ultimately, I think a https://mercure.rocks/ integration would cover the majority of websocket use cases, while better fitting in with Athena's architecture. Can reference https://symfony.com/doc/current/mercure.html for how that might end up looking.

Going to repurpose this issue to represent that implementation.

Blacksmoke16 avatar Dec 23 '21 00:12 Blacksmoke16

Looked into this, and don't actually think it would be all that hard to integrate into the framework. There's still a good amount that needs to be figured out/cleaned up, but I put together a proof of concept: https://github.com/Blacksmoke16/athena-mercure

Overall it's pretty simple, just using normal HTTP stuff. Authentication is a bit more unique, but still mostly just cookies and HTTP stuff via JWTs. The repo could use some more helpers for like auth or discovery, and better way to configure things the way you want. This should be doable via #337 by having a dedicated Athena::Mercure::Bundle that allows configuring things/handling the integration between the framework and a more generic Mercure component.

Deff is something to look into once the config stuff is more ironed out.

Blacksmoke16 avatar Feb 23 '24 16:02 Blacksmoke16