API Reference
An app in Snsary is made up of Sources and Outputs. A Source can subscribe one or more Output objects, which have a publish method to receive Readings i.e. data.
# publish / subscribe pattern
# raises NotImplementedError
Source().subscribe(MockOutput())
PollingSensors are a type of Source that can start and stop i.e. a Service. Every instance of a Service is recorded in a global registry, so the following should be equivalent:
# assign for later use
sensor = MockSensor()
sensor.subscribe(MockOutput())
# specific, direct control
sensor.start()
sensor.stop()
# no need to assign
MockSensor().subscribe(MockOutput())
# general, central control
system.start()
system.stop()
Outputs can also be Services. These concepts are all you need to build an app, but Snsary has a few more tools to hide some of the complexity and reduce the amount of code needed:
StreamsandMultiSourcemake it easier to connectSourcestoOutputs.BatchOutputmakes it easier to build efficientOutputsfor Web APIs.
Table of contents
snsarysnsary.contribsnsary.functionssnsary.modelssnsary.outputssnsary.sourcessnsary.streamssnsary.systemsnsary.utils