0

I am writing a connected home device (alarm system) which can receive events/messages from a mobile device (e.g. a message to dismiss an alarm). Example of a scenario (mobile device is an iphone for the sake of the example):

  1. Connected device at home sounds alarm and notifies the iphone (using iOS push notifications, not firebase)
  2. iphone user brings up the app, and clicks "dismiss"
  3. connected device gets "dismiss" message and stops the alarm

I was thinking about using firebase's live database for this interaction, so the iphone app would set a db field, and the home device (which runs python) would subscribe to this field and see that it has been set.

The problem is that this is not a very clean implementation, as I would need the home device to turn off the dismiss field after it has received it, so that subsequent dismiss event can be recognized.

Essentially I am implementing messaging on top of a live database.

Is there a cleaner way to do this in firebase? If not, is this a reasonable implementation? Are there alternatives to firebase that take care of such a scenario?

What I really need is a web-based event-broker as-a-service...

sagism
  • 881
  • 4
  • 11
  • 18

1 Answers1

1

I would suggest looking at https://github.com/firebase/firebase-queue

There are a few examples of usage on SO such as My Firebase Queue doesn't do anything after I changed to Firebase 3

Many of our developers are using Firebase with a server to perform tasks like background processing, integrating with third party APIs, or handling advanced authentication requirements. Today, we're introducing Firebase Queue, a fault-tolerant multi-worker job pipeline built on Firebase.

If you're writing your server code in Node, Firebase Queue makes it easy to handle background jobs with a worker queue. We're already using it in our private backups feature, where we reliably handle hundreds of jobs per day across multiple machines. ( https://firebase.googleblog.com/2015/05/introducing-firebase-queue_97.html )

Community
  • 1
  • 1
Peter Scott
  • 1,318
  • 12
  • 19