Accessing conn inside of Absinthe subscription

Context:

I am working with a simple subscription
and I want to use Absinthe.Subscription.publish inside of my context api. However when absinthe returns the struct from subscription, i’m getting MyAppWeb.Endpoint instead of my conn.

Question:

My question is how do I access conn value inside of MyAppWeb.Endpoint? For I am trying to access current_user inside of conn.

You publish to a topic of things, not a conn to start with.

Can you describe in greater detail of what you are trying to accomplish? There is no conn inside of MyAppWeb.Endpoint, the Endpoint is only the ‘pipeline’ that sets up and manages connections, the beginning of the Plug pipeline to be specific. What are you trying to access in conn to do?

You won’t get direct access to the conn, but you can add data from the conn to your context. This is explained the Authentication guide.

1 Like