How to get real time data into community cloud streamlit app

i have a raspberry pi that is behind a firewall but has outbound http access.

any streamlit app in the community cloud is in a similar situation, but with inbound and outbound http access.

how can I send, oh say, 12 numbers from the pi to a streamlit app on the community cloud once a second, in real time?

I’ve been trying get requests with curl but streamlit is not receiving the curl command line requests with parameters. the code and problem is in another post here. but that may be the wrong approach.

what is the recommended way to get real time data into a streamlit app running in the community cloud?

Streamlit doesn’t have an API meant for non-user, externally initiated connections. All incoming connections to a Streamlit app should be users (or simulated users through something like Selenium).

If your Raspberry Pi is your source of data and you mean to just stream data while someone is viewing your app, I’d set up you Raspberry Pi to receive requests and have Streamlit reach out to your Raspberry Pi. (e.g. look at something like ngrok)

However, if you mean to use your app as a store of data across all time, I’d recommend setting up a database somewhere instead. Then just have your app pull from that database as needed.

thank you. this is helpful.

I’ve never used ngrok or zrok or tunnelmole. these address the problem I’m facing but have their own complexity and learning curve. the pi can be setup however but inbound access is the main problem.

we’ve got a database setup already with long term storage, locally and at an online mongodb store. this is the current weather station dashboard:

It’s great, except it lacks current conditions.

I’m trying to bring in about 8-12 numbers, live, with current weather conditions straight from the sensors.

Ngrok and similar is not the most appealing. I’ll try to get a command line client to work over standard inbound http.