Black Lives Matter. Please consider donating to Black Girls Code today.

Streaming Data from Firebase into Dash


I’m using Firebase (A real time database) in my Dash app. Currently I’m connecting with Pyrebase (A python-Firebase wrapper) and checking for updates using the dash ‘interval’ functionality which works fine.

Ideally though I’d like to take advantage of Firebase’s streaming functionality and just ‘listen’ to updates via the stream handler, which is setup as follows…

def stream_handler(message):
print(message[“event”]) # put
print(message[“path”]) # Key
print(message[“data”]) # {‘title’: ‘Pyrebase’, “body”: “etc…”}

my_stream = db.child(“posts”).stream(stream_handler)

Does anyone have any advice on how to implement this within a dash app?


1 Like

Unfortunately, there isn’t anyway to “push” updates from the server to the front-end, so using an Interval is the best way to do this right now.

I’d like to support server “push” (websockets) but it’s a big project - if your organization or company would like to sponsor this feature, please get in touch:

1 Like

Do you have any thoughts on implementing this? I am also interested in this, since I hope to use Dash as a labview replacement for low-overhead sensor projects I work with. I’ve done a ton of development with websockets and flask (without React) and am willing to take a stab at it over the next few months if someone wants to spitball ideas on implementation…