Skip to content

Instantly share code, notes, and snippets.

@brutella
Created October 4, 2014 08:10
Show Gist options
  • Save brutella/2031d51f012d12911f42 to your computer and use it in GitHub Desktop.
Save brutella/2031d51f012d12911f42 to your computer and use it in GitHub Desktop.
Inter-app communication proposal

I'm working on a system, which provides sensor data over a specific protocol to clients. There are

  • multiple sensors (S)

  • one bridge (B)

  • multiple clients (C)

    S <-> B <-> C

Multiple sensors report values to the bridge which communicates with multiple clients. The clients can write data to the sensor via the bridge. The communication between the bridge and clients is based on a specific protocol.

The protocol between the sensors and bridge is not specified and should be simple and reliable. I've done a lot of research and came up with the following idea for the communication between sensors and the bridge.

File-based communication

The communication is based on files, similar to Linux's device file architecture. The bridge observes a specific folder in the file system. The folder contains files which are read- and writeable. A sensor program (device driver) writes values to the file, and the bridge is notified and reads the values. If the sensors is writeable, the bridge writes values to the files which are then accessible to the sensor driver.

I see the following benefits

  • Simple: Setting up the folder and writing values to a file is straightforward. There are no requirements on which programming language to use for a sensor driver. A simple shell script can be sufficient.
  • Future-proof
  • Reliable (not sure)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment