diff --git a/backend/src/config/index.js b/backend/src/config/index.js index 59ab20af7..2f8d0ed22 100644 --- a/backend/src/config/index.js +++ b/backend/src/config/index.js @@ -49,7 +49,6 @@ export const serverConfigs = { CLIENT_URI, GRAPHQL_URI, PUBLIC_REGISTRATION: process.env.PUBLIC_REGISTRATION === 'true', - SUBSCRIPTIONS_PATH: '/subscriptions', } export const developmentConfigs = { diff --git a/backend/src/schema/resolvers/posts.js b/backend/src/schema/resolvers/posts.js index 4cb787e2f..af8165997 100644 --- a/backend/src/schema/resolvers/posts.js +++ b/backend/src/schema/resolvers/posts.js @@ -1,14 +1,11 @@ import uuid from 'uuid/v4' import { neo4jgraphql } from 'neo4j-graphql-js' import { isEmpty } from 'lodash' -import { UserInputError, PubSub } from 'apollo-server' +import { UserInputError } from 'apollo-server' import fileUpload from './fileUpload' import Resolver from './helpers/Resolver' import { filterForMutedUsers } from './helpers/filterForMutedUsers' -const pubsub = new PubSub() -const POST_ADDED = 'POST_ADDED' - const maintainPinnedPosts = params => { const pinnedPostFilter = { pinned: true } if (isEmpty(params.filter)) { @@ -20,12 +17,6 @@ const maintainPinnedPosts = params => { } export default { - Subscription: { - postAdded: { - // Additional event labels can be passed to asyncIterator creation - subscribe: () => pubsub.asyncIterator([POST_ADDED]), - }, - }, Query: { Post: async (object, params, context, resolveInfo) => { params = await filterForMutedUsers(params, context) @@ -111,7 +102,6 @@ export default { }) try { const [post] = await writeTxResultPromise - pubsub.publish(POST_ADDED, { postAdded: post }) return post } catch (e) { if (e.code === 'Neo.ClientError.Schema.ConstraintValidationFailed') diff --git a/backend/src/schema/types/type/Post.gql b/backend/src/schema/types/type/Post.gql index 484ad937e..71fcb9605 100644 --- a/backend/src/schema/types/type/Post.gql +++ b/backend/src/schema/types/type/Post.gql @@ -245,7 +245,3 @@ type Query { """ ) } - -type Subscription { - postAdded: Post -} diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index c3441dd41..609c3d800 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -74,15 +74,6 @@ import { mapGetters, mapMutations } from 'vuex' import { filterPosts } from '~/graphql/PostQuery.js' import PostMutations from '~/graphql/PostMutations' import UpdateQuery from '~/components/utils/UpdateQuery' -import gql from 'graphql-tag' -import { - userFragment, - postFragment, - postCountsFragment, - userCountsFragment, - locationAndBadgesFragment, - tagsCategoriesAndPinnedFragment, -} from '~/graphql/Fragments' export default { components: { @@ -222,35 +213,6 @@ export default { this.posts = Post }, fetchPolicy: 'cache-and-network', - subscribeToMore: { - document: gql` - ${userFragment} - ${userCountsFragment} - ${locationAndBadgesFragment('EN')} - ${postFragment} - ${postCountsFragment} - ${tagsCategoriesAndPinnedFragment} - - subscription Post { - postAdded { - ...post - ...postCounts - ...tagsCategoriesAndPinned - author { - ...user - ...userCounts - ...locationAndBadges - } - } - } - `, - updateQuery: (previousResult, { subscriptionData }) => { - const { - data: { postAdded: newPost }, - } = subscriptionData - return { Post: [newPost, ...previousResult.Post] } - }, - }, }, }, } diff --git a/webapp/plugins/apollo-config.js b/webapp/plugins/apollo-config.js index a3ac9805e..b89d9a188 100644 --- a/webapp/plugins/apollo-config.js +++ b/webapp/plugins/apollo-config.js @@ -9,7 +9,7 @@ export default ({ app }) => { const backendUrl = process.env.GRAPHQL_URI || 'http://localhost:4000' return { - wsEndpoint: 'ws://localhost:4000/graphql', // optional + wsEndpoint: process.env.WEBSOCKETS_URI || 'ws://localhost:4000/graphql', httpEndpoint: process.server ? backendUrl : '/api', httpLinkOptions: { credentials: 'same-origin',