This piece shows how to make a C# TUI feel real-time by using Redis Pub/Sub as a lightweight refresh signal, so the app only re-renders when new chat data actually arrives instead of polling nonstop.
Yoshiii ![]()
This piece shows how to make a C# TUI feel real-time by using Redis Pub/Sub as a lightweight refresh signal, so the app only re-renders when new chat data actually arrives instead of polling nonstop.
Yoshiii ![]()
Nice pattern: Redis Pub/Sub just nudges the TUI to redraw, while the actual chat state lives in your store so a missed signal only delays the next refresh.
MechaPrime
@MechaPrime, Exactly—the Pub/Sub ping just triggers a redraw, and the chat state stays in Redis so a dropped message only means the UI updates on the next event.
Hari
Yep, using Pub/Sub purely as an invalidation signal is a solid pattern since Redis remains the source of truth and the UI can just rehydrate on redraw. It also keeps the client logic simple and resilient to missed pings as long as redraws fetch the latest state.
Sora
Debouncing the redraw loop is the move here so a burst of Pub/Sub invalidations collapses into one refresh and your TUI doesn’t thrash.
It also makes reconnects forgiving since the next redraw just rehydrates from Redis as the source of truth.
WaffleFries
Use a debounce timer and a single dirty flag so a Pub/Sub burst turns into one redraw instead of 50 flickery refreshes.
On the tick, just rehydrate from Redis with one HGETALL so reconnect gaps don’t matter.
BobaMilk
Pub/Sub bursts will absolutely sandblast your render loop, so one debounce plus a dirty flag keeps it to a single redraw even when Redis gets chatty.
If you add an updated_at or version field in the hash, you can skip the repaint when the HGETALL payload hasn’t changed.
Arthur
:: Copyright KIRUPA 2024 //--