tartiflette-aiohttp
tartiflette-aiohttp copied to clipboard
Overriding subscriptions message processing logic
Hi,
I am wondering if it is possible to override the subscription _on_connection_init
logic. Right now it only sends ACK completely ignoring the payload, which cuts off one of possible auth methods (connectionParams used by Apollo, Altair, and some other clients).
It is of course possible to do it manually by subclassing AIOHTTPSubscriptionHandler
and manually assigning the websocket route to this subclass, but by doing this I feel I'm doing something wrong.
Hi @upcFrost I think you have the right idea on how I would have done it with the current implementation of ttftt-aiohttp. To provide a bit of context: _
In our minds, tartiflette-aiohttp project is a basic thing used to showcase how aiohttp and tartiflette could interact, but, for instance, it wasn't used at our company because our usecases were too specific and we have done this integration our own way. My point being that either you have a easy usecase and use tartiflette-aiohttp as is, or you need something more tailored and you do your own aiohttp integration.
_
In this specific case you mention, I'll be okay to review, merge and release a PR that add a way to specify a list of callbacks for the websocket event that would be called when theses events occured. If you have the time and want to contribute, i'll be happy with it :D
If you have the time and want to contribute, i'll be happy with it
Want - yes, time - that's another story 😅
But I think a simple parameter similar to engine
, with an instance of the class that extends AIOHTTPSubscriptionHandler
should do the trick.
Anyways, thanks, I think I'll try to make it work the way I described.