Adding extra params to socket opts#103
Open
mjquinlan2000 wants to merge 2 commits intoabsinthe-graphql:mainfrom
Open
Adding extra params to socket opts#103mjquinlan2000 wants to merge 2 commits intoabsinthe-graphql:mainfrom
mjquinlan2000 wants to merge 2 commits intoabsinthe-graphql:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
docmessage. I would like to intercept thedocmessage before it hitsAbsinthe.Phoenix.Channelto 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 anAbsinthe.Phaseprepended to the default pipeline to do this work. The problem is that I do not have access to theidparameter and only have access to thevariablesandquery. 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.