Stuck on "Connecting..." if network switched to slow 4G

Hi Streamlit community,

I’m experiencing an issue where my Streamlit app gets stuck or becomes unresponsive when switching to a slow 4G network (tested via browser’s inspect tool throttle or on a mobile device with poor connectivity). On the top-right of the app, it repeatedly shows “Connection…” and never recovers.

I want to avoid upgrading my dependencies, so I’m looking for solutions that work with my current setup.

App environment:

  • Running locally

  • Python version: 3.12

  • Streamlit version: 1.33.0

Requirements.txt:

streamlit==1.33.0
requests==2.31.0
pandas==2.1.3
streamlit-modal==0.1.2
streamlit-extras==0.4.2

Current .streamlit/config.toml settings tried:

[server]
enableCORS = false
enableWebsocketCompression = false
fileWatcherType = "none"
websocketConnectionTimeout = 300
enableXsrfProtection = false

[browser]
gatherUsageStats = false

[runner]
fastReruns = true

Steps to reproduce:

  1. Open the Streamlit app locally on a PC or phone.

  2. Switch network to slow 4G or throttle network in dev tools.

  3. The app frequently freezes or fails to load new content.

What I’ve tried:

  • Adjusting WebSocket-related and server settings in config.toml. (Note: websocketPingInterval is not an available option in Streamlit 1.33.0.)

  • Disabling file watcher and CORS.

Goal:

  • Make the app handle slow or intermittent network connections better without upgrading Streamlit or other dependencies.