The Quiet Power of Server-Sent Events for Real-Time Apps

Introduction When building real-time web applications, WebSockets often grab the spotlight. They promise robust, bidirectional communication and are frequently the default choice discussed in architecture meetings and tech talks. Meanwhile, Server-Sent Events (SSE) sits quietly in the corner, a powerful but frequently overlooked standard that deserves more serious consideration than it typically receives, especially for specific, common use cases. I recently worked on a analytics project where the initial requirement was “real-time updates, so we need WebSockets.” It’s a common refrain. However, after digging into the actual need… streaming analytics updates to the browser with absolutely no requirement for client-to-server messages over that channel, we pivoted to SSE. The outcome? A noticeably simpler backend, less resource consumption, and a more straightforward codebase to maintain. ...

June 17, 2024 · 10 min · 2020 words · Dennis Lin

Qwik Preview: Rethinking JavaScript Hydration with Resumability

We’ve been wrestling with a performance paradox: we want to build rich, interactive web applications, but the process of getting them into the browser has become increasingly expensive. Hydration has slowly become one of our industry’s biggest performance bottlenecks. I recently spent a weekend exploring this experimental framework, and I’m genuinely intrigued by its approach. While it’s definitely not production-ready yet, Qwik represents a fundamental rethinking of how we deliver JavaScript to the browser. ...

October 3, 2022 · 6 min · 1207 words · Dennis Lin

React 18 in Production: Concurrent Rendering Delivers on its Promise

React 18 launched as a stable release in March, bringing the long-anticipated concurrent rendering engine to production environments. After spending several weeks experiencing it across multiple projects, the performance improvements and developer experience enhancements are visible. What was theoretical in the alpha and beta releases has now proven its worth in real-world applications. Concurrent Rendering: From Theory to Practice In my previous coverage of React 18’s alpha release, I explored the shift from “Concurrent Mode” to “Concurrent React” and the theoretical underpinnings of what makes concurrency special. Now that we’re using it in real applications, let’s see how these concepts translate to practical benefits. ...

May 19, 2022 · 7 min · 1400 words · Dennis Lin

Go and Rust bring unprecedented speed to JavaScript bundling and transpilation

The Status Quo and Its Discontents Before diving into these new tools, let’s consider where we are. For years, Webpack has dominated the bundling landscape, with tools like Babel handling transpilation. These tools, written in JavaScript, have served us well, but as projects grow larger and demands for features increase, their performance limitations have become increasingly apparent. A typical modern JavaScript project involves multiple processing steps, each adding to build time. First comes transpiling ES6+ syntax for browser compatibility, followed by converting TypeScript or Flow to JavaScript. Then there’s the transformation of JSX into React function calls, bundling of hundreds or thousands of modules, minifying the resulting code, and finally generating source maps. For large projects, this full process can take minutes—a real drag on development velocity. ...

September 29, 2021 · 6 min · 1091 words · Dennis Lin

Code Splitting with @loadable/component

The Code Splitting Dilemma The React team recognized bundle size challenges by introducing React.lazy() and Suspense for component-based code splitting. This native solution works great for client-side rendering, but falls apart when you need SSR: // This works fine with client-side rendering const LazyComponent = React.lazy(() => import('./LazyComponent')); function MyComponent() { return ( <Suspense fallback={<div>Loading...</div>}> <LazyComponent /> </Suspense> ); } If you’re using Next.js, Gatsby, or any other SSR solution, the code above will throw the dreaded error: “Suspense is not supported during server-side rendering.” ...

April 30, 2021 · 4 min · 651 words · Dennis Lin