⚠️ 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

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.