Ember updates my client data almost immediately after a database change


#1

Hi there, this is not really a bug but just something that I’m mostly just surprised by.

I am using Firebase as our companies back-end database for a couple of small services. I have two completely separate web applications but they use the same firebase database. I figured that that the way it ought to work is that if I update a certain object in one web app, the other web app would not know about it until it called model() again. That doesn’t appear to be true though. As soon as I update Firebase, the other website immediately updates with the new information (no refresh require or explicit querying required).

Is this normal for Ember? Does my website just keep querrying Firebase for updates every second? How did Ember know the database got updated without me ordering any queries or refreshing anything. I’m still learning how to use Ember.

Thank you!


#2

Hey @keanedawg, that’s not really an Ember behavior, it’s specific to Firebase. It’s actually one of the coolest parts of firebase! The short version is that firebase uses a websocket connection (it doesn’t need to poll, the server can basically “push” data to the client) and Emberfire contains some specialized adapter code that auto-updates your records whenever they change in the backend. This is part of why (at least I think) the “main” feature of firebase is called the “real time database”.


#3

I see. Thank makes more sense. Thank you!