Introducing Keepy, your Streams Gateway keeper
The full article was originally published by IOT2TANGLE on Medium. Read the full article here.
Learn more about this tiny application that enhances your experience interacting with our Streams Gateway.
Streams is a level 2 cryptographic framework to send data over the IOTA Tangle. We developed a generic gateway to allow different devices using the I2T Standard, to publish their data on Streams in an easy fashion.
To this end, our I2T Gateway listens for data sent via POST requests and sends it to the Tangle via Streams. On the other end, we have provided a I2T Decoder, allowing for subscriptions to existing channels carrying information.
Streams acts as your immutable data storage, distributing the information amongst the network nodes. What is published there is there for good.
Streams runs on top of IOTA transactions. Therefore, each data set sent requires a little proof-of-work, limiting the granularity of inputs. Sending a data set per second would result in an overloaded full node, breaking the Gateway’s ability to do its job.
On the other side, Streams channels do not allow to get a subset of messages (i.e. the last 5 published messages). This proved to be an issue while designing IoT applications that needed to persist object’s statuses such as your living room lamp and access it to perform actions.
Keepy is here to help you to overcome these two obastacles.
Keepy is a small Nodejs application that sits in front of the Streams Gateway to receive sensors’ data and return it on demand. It basically mounts an endpoint you can POST data to. The data is stored on Streams and a local Database that keeps an association between each data set and the Streams channel id containing it. You can query Keepy for a certain number of datasets (i.e. the last one) on a given channel and get an immediate response from the local database, including the datasets requested and their channel ids. This way you get fast read times and the ability to validate the data integrity against the Tangle.