Closed shantanoo-desai closed 5 years ago
will reopen it once a concrete setup is up and running
Based on #11 I will write a blog post to practically use this repo alongside graphql
Sounds great @shantanoo-desai! Please link it here when it's up!
btw, all subscription packages work similarly so you might want to head over to apollo's graphql-subscriptions repo to get information about asyncIterables
and the api to transform and filter them. This package is intended to be more like an addon to graphql-subscriptions because the actual pubsub manager can be easily replaced for something like redis / rabbitmq or whatever actually.
Regarding your issue here:
subscribeSite: (args) => {
pubsub.asyncIterator(args.topicInput.topic)
}
Please note that you are not returning anything in this arrow function. The simplest form of subscription resolver should return an object with a subscribe
property that has an iterable factory.
There are good examples here: https://github.com/apollographql/graphql-subscriptions#getting-started-with-your-first-subscription
Let me know if you need anymore help there and I would love to merge a working example to this repo's README file.
Hi @davidyaha I have written a blog post documenting a live IoT Data along side MQTT GraphQL Endpoint with Apollo Server here. Let me know if you find this useful or not.
@shantanoo-desai 🎉 🎉 Awesome use case!! Would love to see an app that utilizes this graphql api!
@davidyaha I do actually have something in mind but requires a bit more thought. I figured out that GraphQL Schemas can Adapt EPCIS aka. product RFID very well.
An really practical example might be Subscribing to live product tracking within companies or factories via MQTTPubSub
.
Hi @davidyaha I am working on this repository with
express-graphql
and was looking into documenting a practical example via MQTT. I am not usingtypescript
but standardES6
stuff. Would you be able to just guide me with how do I get the data from the Broker out?Progress
Defined a Schema as following:
schema.js
resolvers.js
I did the following:
within the resolver function:
I am not sure how do I get the value from the
asynIterator
at this point and return it to the GraphiQL UI.I already have a setup where live data is sent via sensor nodes and maybe the repo could benefit from a nice working example writeup