Skip to content

Conversation

@michaeljguarino
Copy link

Absinthe has a unique protocol on top of pheonix wss to support GraphQl subscriptions, in that each subscription document sent creates a shadow channel that the client then has to manually subscribe to. I couldn't find any existing function to support it using PhoenixClient.Socket so I implemented this, and it seems functional from my testing.

The process to create a working graphql subscription publishing to the current process becomes:

with {:ok, %{"subscriptionId" => id}} <- Channel.push(absinthe, "doc", %{query: query, variables: variables}),
      do: Socket.listen(@socket_name, id, self())

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.

1 participant