Your Privacy

This site uses cookies to enhance your browsing experience and deliver personalized content. By continuing to use this site, you consent to our use of cookies.
COOKIE POLICY

Skip to main content

Achieving Real-Time Functionality in a Web App — the ‘Right’ Way

Achieving Real-Time Functionality in a Web App — the ‘Right’ Way
Back to insights

Today, there are many scenarios in which we expect real-time (or near real-time) functionality from our web applications. Often it is not even a conscious expectation—but instead is a more subtle enrichment of user experience that many take for granted. When I encounter this demand in my web development work, I take a step back to consider the ‘right’ solution for that particular context. This is because there are numerous ways of achieving a real-time experience (or the illusion of it)—be it through programmatically re-executing data queries or by opening a steady two-way data stream via a WebSocket subscription; or anything in between. Making the ‘right’ choice requires that a developer weigh the application’s needs against the performance expenses associated with the various data acquisition methods. 

Perhaps the most straightforward way to keep the client (your users) seamlessly up to date with your backend is through intermittent polling. For example, an investment application might allow its users to track their favorite stock prices by re-executing a query of the stock data every 10 seconds, perhaps even re-rendering some corresponding charts or graphs with that cadence as well. This approach can and does gracefully cover many use cases and provides a predictable, relatively responsive experience. The downside: polling can be expensive—especially when you are repeatedly querying for large, complex objects for which most of the fields change infrequently.  

A more holistic approach to keeping the client in sync with your backend is using a subscription: a means of bidirectional communication that allows information to flow freely without needing to re-query the database. This persistent connection is usually achieved by communicating via WebSocket (WS) rather than the standard HTTP transport. The power of subscriptions lies in their ability to communicate updates to individual fields as they occur in the database. For this reason, the approach proves very efficient in the case of small, incremental changes to large data objects.  In addition to their efficiency, subscriptions bring true real-time functionality to the table. In cases where your application demands new information as soon as it is available (think instant messaging), the subscription approach provides what is perhaps the very best sustained low-latency solution.  

On the other hand, if your application only needs an update every 5 minutes, it is less expensive to re-initiate an HTTP connection with each update than keeping a WS connection open for that duration when no immediate updates are required or available. The decision between the two protocols always includes weighing the two costs in your specific use case. Option one is the cost of keeping an existing WS connection open (in which case the client constantly receives information—albeit only the response data and a very small header). The second option is the cost of establishing a new HTTP connection (which requires that the client send large headers with the request and receive large headers back with the response). Whatever the best solution may be for your web application, adding real-time functionality can significantly enrich your end-user’s experience and inspire confidence in the app.

Digging In

  • Digital Products

    What to Ask in a UX Discovery Session

    Better questions lead to better design. In my years as a UI/UX designer, I’ve learned that many design challenges may come from misalignment at the start. Discovery sessions are where product clarity is either made or missed. These are a few discovery questions I consistently return to in the discovery phase of my UX design […]

  • Digital Products

    Designing For Play and Friction in a Fast-Paced World

    At UDig, play is an integral part of our philosophy. “Having fun” is embedded in our culture, and we always find opportunities to use play to encourage collaboration, ignite creativity, and make room for bold experimentation to build stronger teams and solve problems ranging from the seemingly simple to the most complex. I always have […]

  • Digital Products

    Config 2025 Day Two Recap

    It felt as though Config 2025 ended as soon as it began, and I believe those of us that attended are all the better for it. By the end of the day, various inspirational and informative talks had been given by thought leaders and innovators in the product space. Between sessions, we had the opportunity […]

  • Digital Products

    Inside Config 2025: What’s New in Figma

    Config 2025 kicked off with a bang on Day 1. Figma’s annual conference brings together designers, developers, and all those involved in the making of a product. The 2-day event has a stacked lineup of accomplished speakers ready to share their insights on the world of product building. At today’s opening keynote, the Figma team, […]

  • Digital Products

    Choosing the Right Modernization Approach

    When organizations decide it’s time to modernize their technology infrastructure, choosing the right approach is crucial. Modernization isn’t merely a technical upgrade; it’s a strategic business move that significantly impacts growth, agility, and long-term success. Here’s how your company can effectively begin to select the best modernization strategy tailored to your goals and challenges. In […]

  • Digital Products

    TAG Panel: Differentiate Your Customer Experience

    Join the CX and Product Management Societies to hear from our panel of Human-Centered Design experts on the business value of Agentic AI.