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

Feature request: Subscriptions #4

Open
itsezc opened this issue Jan 7, 2021 · 5 comments
Open

Feature request: Subscriptions #4

itsezc opened this issue Jan 7, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@itsezc
Copy link

itsezc commented Jan 7, 2021

Are there any plans to support Subscriptions?

and how about other features such as @batch, @relay, @defer, @stream and @live (Apollo GraphQL Blog)

I understand that said features would take considerable effort to implement, but I'm sure that if there was to be a roadmap the community will start submitting PR for these features.

@jgillich jgillich added the enhancement New feature or request label Jan 12, 2021
@jgillich
Copy link
Member

The goal is to support the latest GraphQL spec, so that's a yes regarding subscriptions. Not a fan of supporting out of spec extensions at least for now, but it looks like some of them might become part of the next GraphQL version anyhow.

@vrishtrix
Copy link

+1 I need subscriptions

@thomasDelaporte
Copy link

thomasDelaporte commented Jan 18, 2021

I'd love for @live and @stream to be supported, I have been waiting on Apollo 3.0 far too long

@jgillich
Copy link
Member

I've looked into subscriptions and I feel like the best way to implement them is via channels:

class Subscription
  @[GraphQL::Field]
  def example : Channel(String)
    channel = Channel(String).new
    spawn do
      channel.send "foo"
      channel.send "bar"
    end
    channel
  end
end

For triggering updates from mutations one could use a channel on Context, so I don't think we need to add anything for that.

The spec doesn't define any transport protocol or format, but the most sensible thing seems to be to do what Apollo/graphql-ws do, with the ability to override it.

Does that sound good?

@atik7
Copy link

atik7 commented Mar 30, 2022

Please make example for redis ( https://github.com/davidyaha/graphql-redis-subscriptions ) , so it will be easy to put crystal app along with nodejs implementation syncing states, thanks,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants