Feature request: Subscriptions
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.
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.
+1 I need subscriptions
I'd love for @live and @stream to be supported, I have been waiting on Apollo 3.0 far too long
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?
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,