Gabriel Morell


An API envoy for memory limited devices

Send the envoy
posted June 23, 2017, 2:17 a.m.
under thingenvoy · perma

While implementing a stream parser for JSON responses for each and every wireless microcontroller project I build seemed like a fantastic use of time, I figured that I could minify responses coming from large APIs and only pull out the pertinent information that the microcontroller would need to use. Thus was born the Envoy. The envoy sits between a microcontroller and a datasource and through a series of user configurable rules will pull out the relevant data.

The initial purpose for this was polling the old hubway API that would return all the stations in the system and their statuses which was in the tens of kilobytes and would exhaust my heap. The initial version worked well and there was value in making it generic.

On top of being a minifier, the original unfiltered payload is cached in memory. This is so different devices are able to poll the same Envoy instance at the same time and have their own unique filtering rules against the original payload while lowering the call count to the original service. Users are able to configure a TTL on their filter rules to uniquely control when the microcontrollers get fresh data.