Skip to content

Instantly share code, notes, and snippets.

@sorenbs
Last active January 11, 2017 13:06
Show Gist options
  • Save sorenbs/18938a93afa87bd68e91820d7ad1b4da to your computer and use it in GitHub Desktop.
Save sorenbs/18938a93afa87bd68e91820d7ad1b4da to your computer and use it in GitHub Desktop.

Graphcool Subscriptions

Subscription events are triggered in response to a mutation and the schema mirrors mutations directly. To subscribe to new Posts:

subscription {
  createPost {
    id
    imageUrl
    description
  }
}

Example

Check out the example at https://github.com/graphcool-examples/react-apollo-instagram-subscriptions-example

This is a simple extension of our Instagram example that simply refetches the list of posts when a new post is created

Subscription Debugger

During the beta period we are working on integrating subscriptions in the Graphcool Playground. Until that is done you can use this extended version:

http://graphcool-subscriptions-debugger.surge.sh/

Issues

This is a beta, but we don't expect any major issues. Should you find anything, please let me know in slack or by mail.

If you test it out and everything works, I would also really appreciate it if you could let me know.

Thanks and happy hacking!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment