michaelcaterisano
How to add a phase to the Absinthe subscription pipeline?
The pipeline docs say to See Absinthe.Phoenix on adjusting the document pipeline for GraphQL over Phoenix channels, but I don’t see anything about adjusting the pipeline in those docs. How can I add a phase to the Absinthe.Phoenix pipeline?
Most Liked
benwilson512
Hey @michaelcaterisano yeah that does seem to be missing from the docs. Basically, just like plug you do:
pipeline: {SomeModule, :some_function}
Then you have some_function that tweaks the pipeline like it would for a plug.
EDIT: OOPS didn’t see your reply. Yup you have it, PR welcome for the docs!
benwilson512
EDIT: my memory is wrong
@michaelcaterisano Apologies, what you want is:
def some_function(schema, config) do
schema
|> Absinthe.Phoenix.Channel.default_pipeline(config)
|> # do your stuff here.
end
michaelcaterisano
@benwilson512 I’m trying to insert a phase in this pipeline. I tried:
schema
|> Absinthe.Phoenix.Channel.default_pipeline(config)
|> Absinthe.Pipeline.insert_after(Absinthe.Phase.Document.Result, API.Web.GraphQL.Phase.MyPhase)
My phase looks like:
defmodule API.Web.GraphQL.Phase.MyPhase do
@behaviour Absinthe.Phase
@impl Absinthe.Phase
def run(blueprint, _) do
blueprint
end
end
but it doesn’t seem to be reaching my phase. Do I need to be implementing a different behavior here?







