gregmarra/the-blue-alliance — pull request #373 by fangeugene (2012-12-24 09:06:27+00:00)
Title: Firebase Push notifications -- Example: GameDay Score Feeed

I was doing research on GAE's Channel API, and it looks like it wasn't made to do "fan-out" style push notifications, but rather one to one connections. That means if we want to push match updates as we get them to all users, we have to iterate through a list of connected users and send each user the message. Definitely not ideal, so I started looking for third party solutions that were appropriately priced.

I have a friend who works at [Firebase](http://www.firebase.com), and he was awesome enough to get me a beta access key. In beta, all plans are free, but even out of beta the [free tier](https://www.firebase.com/pricing.html) seems like enough to handle our needs. Peak concurrent users might be our only limit.

Firebase's primary purpose is to let developers create real-time web applications using almost exclusively front-end code and using their service as a concurrent database that can update clients' pages in real time. In my implementation, GAE pushes match data to Firebase, which in turn pushes the data to update the score feed bar on GameDay.

To test:

1. Even though the backend changes the Firebase URL based on dev/production, the front end JS code always accesses the production Firebase URL, so you'll need to change it to correct one as shown in tba_config.py, and recompile Javascript.

2. Go to the TBA admin console and edit a match.

3. The new match should appear on GameDay's feedbar.