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

Relay and GraphQL QueryStreams #652

Closed
zuhair-naqvi opened this issue Dec 5, 2015 · 5 comments
Closed

Relay and GraphQL QueryStreams #652

zuhair-naqvi opened this issue Dec 5, 2015 · 5 comments

Comments

@zuhair-naqvi
Copy link

Is there a Relay construct analogous to Mongoose QueryStreams (http://mongoosejs.com/docs/2.7.x/docs/querystream.html) with Relay? i.e. rather than polling the GraphQL endpoint, perhaps subscribe to a QueryStream over web-sockets into the GraphQL server?

  1. I think this would fit nicely with GraphQL subscriptions
  2. Being able to play / pause / close / open streams for queries would be very useful - i.e. you would get the benefits of observables (ability to cancel a promise / unsubscribe aka close a queryStream) without using RxJS
@josephsavona
Copy link
Contributor

Subscriptions are designed as a sort of declarative analogue to imperative stream mechanisms (querying data inside a stream callback could cause the n+1 query problem because the streams aren't statically conposable).

What specific functionality about streams would you want separate from the subscriptions API? (see the issue for this).

@zuhair-naqvi
Copy link
Author

The usecase is push messaging, if the app is primarily event driven, you don't want to be constantly polling the graphql server for updates.

I see DiscordApp which apparently is built on Relay uses websockets
screen shot 2015-12-06 at 9 37 00 pm

Any ideas on a canonical way to achieve this?

@josephsavona
Copy link
Contributor

Just checking. This is exactly the use-case that GraphQL Subscriptions are meant to address. This is still an active area of exploration, and we're tracking progress at #541.

@zuhair-naqvi
Copy link
Author

Thanks I'll follow the issue.. PS did some digging found this https://gist.github.com/ngthorg/21a986962228f53a3ec5 .. your thoughts?

@josephsavona
Copy link
Contributor

We've documented our thoughts on subscriptions pretty extensively in a dedicated blog post :-)

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

No branches or pull requests

2 participants