⚠️ This lesson is retired and might contain outdated information.

Write a GraphQL Subscription Query in the Graphiql Editor

Ian Jones
InstructorIan Jones
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 2 years ago

In this lesson, we write a GraphQL subscription query to subscribe to comment events on a GitHub issue in the OneGraph Graphiql editor.

Instructor: [0:00] We're back in our OneGraph dashboard. I'm going to go to the Data explorer. I want to create a subscription, so I'll hit the + button. Now, you can see the Subscription explorer here. I want github. I want the issueCommentEvent.

[0:20] We want a variable called repoName, so we'll add it, and repoOwner, we'll add it. You can see that I have both of those variables here. Then, let's grab the action. Then on the comment itself, the author login. We'll grab the body, the id, the url, and viewerDidAuthor.

[0:59] Over in our editor, we can see the subscription query that was generated for us. When I hit run, I'm going to hit MySubscription, you can see it but now there's a stop button here. Nothing is showing up because we are subscribing to these events.

[1:17] We have to wait for an issue to actually come in over in our React App. Let's add another comment. You can see we created the comment and now, over in our Graph coeditor, here's the subscription data that came through.

egghead
egghead
~ an hour ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today