Apps vs State vs Services: The App

hurlbert
2 min readSep 26, 2017

--

[Part 2 of 6]

My recent efforts to build a message board / info radiator have given me some insight. It would turn out that the services would be trivial to build. I had most of the services built already. As an organization matures and their version of “the system” evolves they too should have many of the services needed already built.

The application itself was a bear. The message board is simple. The challenge of running 24/7, no matter what happens, is not.

The primary complication of the message board is staying connected. I’m using MQTT as my message bus. It runs on small devices. It’s open source. It’s fast. It’s low overhead. It’s also not very well supported on Windows. The windows MQTT server I’m using can be a bit flaky. My app detects when it’s disconnected and attempts to reconnect. It also tries to detect when it seems like it’s still connected but messages have stopped flowing. The app receives regular status updates (described below). The app uses these messages to detect stream failures.

When “idle” the message board displays a status message. I don’t want the status message to get stale. Every so often the message board asks for a status update. Displaying the status should never interfere with the display of other messages.

Here are the challenges I ran into developing this app:

  • Connecting
  • Staying connected
  • Throttling requests for status
  • No UI of any kind

To throttle requests I created a throttle called “MeteringLight.” The metaphor came from the metering lights on the Bay Bridge. A key function of the metering light is that it’s default state is GO. In other words, when it’s off nothing is throttled.

To handle reconnect attempts I created a class called “Attempt.” It has events for “Success,” “Failure,” and “FailedAttempt.” It allows the configuring of things like the delay between attempts, and the number of attempts to make, etc. [This serves a function very similar to that of Poly if you’re familiar with it.]

Connecting and connected are another story all together. This is where the story of the message board intersects with “The Method.” Within the application Connecting and being connected are areas of volatility.

[part 3]

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response