Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding extra params to socket opts #103

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mjquinlan2000
Copy link

In our application, we are using persisted queries to cut down on network traffic. We have been using this feature for our regular mutations/queries for a while by implementing a Plug to fetch these documents from our document store at runtime when a request comes in with a document id. The payload looks something like this for regular http requests:

{
   "id": "thequeryid",
   "query": "",
   "variables": {"some": "vars"}
}

I would like to be able to extract the document id from the payload in a subscription doc message. I would like to intercept the doc message before it hits Absinthe.Phoenix.Channel to swap out the document according to the passed ID, however, there is no apparent way for me to do this easily. I would like to resort to using an Absinthe.Phase prepended to the default pipeline to do this work. The problem is that I do not have access to the id parameter and only have access to the variables and query. I think it would be beneficial for this scenario (and maybe others) to pass the extra payload parameters to the pipeline via options to allow handling of any extra variables submitted during subscription.

@mjquinlan2000 mjquinlan2000 changed the title Adding extra params to socket opts for access in phase Adding extra params to socket opts Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants