Streamlit Push(st-push)
A Streamlit real-time push component
— mounts a WebSocket route onto Streamlit’s Starlette App for true server-to-browser push, with per-connection AES-256-GCM encryption and module routing so multiple components can coexist on one connection.
Installation
Not published to PyPI. Build from source, access resource from st-push (github):
pip install st_push-1.1-py3-none-any.whl
Requirements: Python 3.8+, Streamlit >= 1.59.1, starlette >= 0.40.0. The cryptography package is optional (used for AES-GCM; falls back to XOR+HMAC otherwise).
Quick start
1. Launcher: mount the WebSocket route
st-push does not start a separate port or service. You mount its routes onto Streamlit’s Starlette App.
# app.py
from streamlit.web.server.starlette import App
import st_push
app = App("script.py", routes=st_push.create_push_routes())
if __name__ == "__main__":
app.run()
2. Script: create a PushClient and use components
import streamlit as st
from st_push import PushClient
from st_push.comp.chat import ChatClient
from st_push.comp.notify import NotificationClient
# Application layer creates a shared PushClient (session singleton)
push_client = PushClient.session_instance(user="alice")
# Inject it into components — they share the same push_client
chat = ChatClient(push_client, user_name="alice")
notifier = NotificationClient(push_client, user_name="alice")
# Render and send
chat.render(peer="bob")
notifier.render()
chat.send("Hello!", to_user="bob")
notifier.send_notification(to_user="bob", title="New task", body="Fix the login bug")
3. Run
python app.py
demos