I'm using the Apollo graphql framework, seemingly getting the subscription up and running. But I'm unable to get any events triggered from the subscription and the documentation around Apollo client is rarely about pure nodejs and vanilla javascript.
The project is making a few nodes for node-red, which will use a vendors graphql interface to fetch different data on power consumption and electricity pricing. For this purpose, I need to use subscriptions as well. Quite new to graphql and was recommended the apollo framework.
result = tibber.getSubscription('subscription{ liveMeasurement(homeId:"c70dcbe5-4485-4821-933d-a8a86452737b"){timestamp power maxPower accumulatedConsumption accumulatedCost}}');
// returns an Observable from the apollo client subscribe()
// client.subscribe({ query: gql`${query}` });
let sub = result.subscribe({
next (data) { console.log(data); },
error (err) { console.log(err); }
});
Would have expected the console.log to trigger with some data after a few seconds, as this subscription works with the demo account on the api explorer of the vendor. No errors returned and subscription object (sub) is in 'ready' state.