Closed artificial-mwatson closed 2 years ago
Hi, the context is indeed available, please see the example shown here: https://hexdocs.pm/absinthe/Absinthe.Schema.Notation.html#config/1-examples
Many thanks, @benwilson512!
Since subscription goes over a Phoenix.Socket, and Sockets don't go through the Plug pipeline (near as I can tell), sockets don't work with conns. So I haven't found a way to get something into the context for access in the absinthe config macro, as @benwilson512 showed.
Hi @artificial-mwatson please use the slack or the forums for questions not the issue tracker. This is also covered in the docs https://hexdocs.pm/absinthe_phoenix/Absinthe.Phoenix.Socket.html#content
Some customers, when they submit a subscribe document want us to send them the "current" version of what they're subscribing to. The problem is that doing so requires access to the context which contains information about the user, their authentication, and key values that are needed to be able to send them the correct data.
The subscription's config macro doesn't seem to give us access to the context that the plug inserted for that user. Is it possible to access the context from inside the config so we can trigger the proper channel publish operation?
We're migrating from Apollo, and this was something they had in Apollo that we'd like to preserve.
Thanks.