sebastien
04/10/2017, 8:01 PMartyom
04/10/2017, 8:26 PMnilan
04/10/2017, 8:27 PMit’s using Client from that package, but it looks like it was renamed to SubscriptionClient if I’m correctyea you're right @sebastien! 🙂 what's the exact error message? maybe @kamil can help you out with that
sebastien
04/10/2017, 8:45 PMERROR in ./~/subscriptions-transport-ws/dist/helpers.js
Module not found: Error: Can't resolve 'graphql-tag/printer' in '/Users/metal/Desktop/meal-plan-generator/meal-plan-generator-app/node_modules/subscriptions-transport-ws/dist'
@ ./~/subscriptions-transport-ws/dist/helpers.js 2:16-46
@ ./~/subscriptions-transport-ws/dist/client.js
@ ./src/app/home/home.component.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?<http://localhost:4200> ./src/main.tssebastien
04/10/2017, 8:45 PMsebastien
04/10/2017, 8:49 PMngOnInit() {
const queryObs = this.apollo.watchQuery({
query: gql`
query allPosts {
allPosts {
id
content
}
}
`
});
this.allPostsSub = queryObs.subscribe(({data, loading}: any) => {
this.posts = data.allPosts;
this.loading = loading;
});
const wsClient = new SubscriptionClient('<ws://subscriptions.graph.cool/cj1cd3wb70zy80113yybu3gux>', {
timeout: 10000
});
wsClient.subscribe({
query: `subscription {
allPosts {
id
content
}
}`,
variables: null
}, (err, res) => {
queryObs.refetch();
});
}sebastien
04/10/2017, 8:50 PMsebastien
04/10/2017, 8:56 PMnilan
04/10/2017, 8:58 PMsebastien
04/10/2017, 9:03 PMnilan
04/10/2017, 9:23 PMnilan
04/10/2017, 9:23 PMsebastien
04/10/2017, 9:24 PMnilan
04/11/2017, 8:20 AMkamil
04/11/2017, 10:44 AMsubscriptions-transport-ws since v0.5.4 is no longer using graphql-tag/printer internally so by updating the package to 0.5.4 (not 0.5.5-alpha*) will helpkamil
04/11/2017, 10:46 AMgraphql-tag/printer but I don't think you do, try to use graphql/language/printer insteadsebastien
04/11/2017, 4:37 PM