-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This follows the first few steps in the [Apollo Documentation](https://www.apollographql.com/docs/graphql-subscriptions/subscriptions-to-schema.html) for adding subscriptions to graphql. It sets up the schema to handle subscriptions and also creates the very initial integration with the PubSub implementation baked into the graphql-subscriptions library. As noted in that library, it is only appropriate for demos, not production. We will eventually want to replace it with a more robust PubSub implementation. Issue #44 Issue #43
- Loading branch information
Showing
5 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { GraphQLString, GraphQLInt, GraphQLList } from 'graphql' | ||
import { PubSub } from 'graphql-subscriptions'; | ||
|
||
// App Imports | ||
import SentenceType from '../type' | ||
import { sentenceAdded } from '../resolvers' | ||
|
||
const pubsub = new PubSub(); | ||
|
||
export const sentenceAdded = { | ||
type: SentenceType, | ||
resolve: pubsub.asyncIterator('sentenceAdded'), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { GraphQLObjectType } from 'graphql' | ||
|
||
// App Imports | ||
import * as sentence from './sentences/fields/subscriptions' | ||
|
||
// Compile into a single export | ||
const subscription = new GraphQLObjectType({ | ||
name: 'subscription', | ||
description: '...', | ||
|
||
fields: { | ||
...sentence, | ||
}, | ||
}) | ||
|
||
export default subscription |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters