uesteibar / neuron

A GraphQL client for Elixir
https://hex.pm/packages/neuron
Other
331 stars 35 forks source link

Support subscriptions #33

Open uesteibar opened 5 years ago

uesteibar commented 5 years ago

It would be great to implement support for subscriptions using websockex. The usage could roughly be:

defmodule SubscriptionExample do
  use Neuron.Subscription

  @url "https://my.awesome.graphql/endpoint"
  @query """
  subscription {
    user {
      name
    }
  }
  """

  def start_link(state) do
    Neuron.Subscription.start_link(@url, @query, __MODULE__, state)
  end

  def handle_update(data, state) do
    IO.puts "Received Update - #{inspect data}"

    {:ok, state}
  end
end

Which would be very similar to how websockex works.

churcho commented 3 years ago

Any update on this feature request?

uesteibar commented 3 years ago

@churcho not really, I haven't gotten the time to get on this myself, although contributions are always welcome. I'll otherwise eventually build it, but I can't promise when 😄