TLDR Web Dev · ARTICLES & TUTORIALS

HOW WE SPED UP SEARCH LATENCY WITH SERVER-SENT EVENTS IN EXPRESS.JS

hyperdx.io3 min read

Summary from the TLDR Web Dev newsletter

Using HTTP to query for a search works, but it's not the most optimal UX if your query takes a long time. Users have to wait for the entire search to complete, which can take up to 30 seconds for sparse queries that are not requested often. A better UX would be to stream responses as you query, which can be accomplished with Server-sent events (SSE). This article explains how SSE works, how it differs from traditional web sockets, and how you can integrate it in Express.js.