anycable / graphql-anycable

A drop-in replacement for GraphQL ActionCable subscriptions. Works with AnyCable.
MIT License
112 stars 18 forks source link

Not working in graphql 1.10.0 #5

Closed gastonmorixe closed 4 years ago

gastonmorixe commented 4 years ago

I just created why here rmosolgo/graphql-ruby#2692

Envek commented 4 years ago

Oh, that's unfortunate. I will investigate how to work around it the next week. Thank you for the report!

gastonmorixe commented 4 years ago

@Envek pushed a PR, works for me but it's not clean, let me know your thoughts! thanks

gastonmorixe commented 4 years ago

I ended up not using this because it's hard to set up in Heroku but I hope it helps to fix this issue.

Envek commented 4 years ago

I tried to upgrade one of my application to GraphQL-Ruby 1.10 and it works well without any changes to graphql-anycable. Can you please share how do you use your subscriptions and what isn't working?

Namely:

I will try to reproduce and investigate further.

gastonmorixe commented 4 years ago

I used the new interpreter/runtime.

Envek commented 4 years ago

Have you added following extend to your root Subscription type?

extend GraphQL::Subscriptions::SubscriptionRoot

As per https://github.com/rmosolgo/graphql-ruby/issues/2727#issuecomment-584870542

Envek commented 4 years ago

When I started to add testing for interpreter runtime, specs failed.

What is helped to fix them is to redefine subscription resolver methods as per https://github.com/rmosolgo/graphql-ruby/issues/2754#issuecomment-587557702

class SubscriptionType < GraphQL::Schema::Object
  extend GraphQL::Subscriptions::SubscriptionRoot

  field :product_created, Product, null: false, resolver_method: :default_resolver
  field :product_updated, Product, null: false, resolver_method: :default_resolver

  def default_resolver
    return object if context.query.subscription_update?

    context.skip
  end
end
Envek commented 4 years ago

Closing as it works in production apps and tests also pass. If you find any issues, feel free to open new issue with reproduction steps, schema and so on.