Rainer Stropek
Leveraging Server-Sent Events (SSE) for Efficient Data Streaming in UI Development
#1about 6 minutes
The core problem of long-running HTTP requests
A simple demo illustrates poor user experience when a backend operation takes several seconds to complete, leaving the UI unresponsive.
#2about 6 minutes
Manually streaming data with HTTP chunks
Learn how to send partial responses from a Node.js server using `response.write` and process them on the client with `ReadableStream` and `TextDecoder`.
#3about 7 minutes
Introducing the Server-Sent Events protocol
The SSE protocol simplifies streaming by using a `data:` prefix and the browser's built-in `EventSource` API, which also handles automatic retries.
#4about 4 minutes
Using named events for structured messages
The SSE protocol supports sending named events using the `event:` key, allowing for more structured communication handled by specific event listeners on the client.
#5about 5 minutes
Ensuring reliable delivery with message IDs
Implement robust streaming by using the `id:` field in SSE messages, which enables the client to automatically send a `Last-Event-ID` header upon reconnecting.
#6about 7 minutes
Why SSE is relevant again because of OpenAI
OpenAI's streaming API uses Server-Sent Events extensively, leading to a resurgence of the technology for building real-time AI applications.
#7about 6 minutes
Building a streaming client for the OpenAI API
A practical demo shows how to use the OpenAI SDK, which abstracts SSE into a `for await` loop, and then stream the results from your server to the client using SSE.
#8about 12 minutes
Q&A on SSE implementation and best practices
Discussion covers topics like connection timeouts, keep-alive messages, server scalability for many connections, and use cases beyond text streaming.
Related jobs
Jobs that call for the skills explored in this talk.
Hubert Burda Media
München, Germany
€80-95K
Intermediate
Senior
JavaScript
Node.js
+1
Matching moments
03:31 MIN
The value of progressive enhancement and semantic HTML
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
02:33 MIN
Why you might not need JavaScript for everything
WeAreDevelopers LIVE – You Don’t Need JavaScript, Modern CSS and More
04:57 MIN
Increasing the value of talk recordings post-event
Cat Herding with Lions and Tigers - Christian Heilmann
03:16 MIN
The importance of client-side encryption for AI features
AI in the Open and in Browsers - Tarek Ziadé
02:49 MIN
Using AI to overcome challenges in systems programming
AI in the Open and in Browsers - Tarek Ziadé
03:16 MIN
Improving the developer feedback loop with specialized tools
Developer Time Is Valuable - Use the Right Tools - Kilian Valkhof
11:10 MIN
The only frontend stack that truly matters
WeAreDevelopers LIVE – Frontend Inspirations, Web Standards and more
08:07 MIN
Exploring modern JavaScript performance and new CSS features
WeAreDevelopers LIVE – AI, Freelancing, Keeping Up with Tech and More
Featured Partners
Related Videos
Streaming AI Responses in Real-Time with SSE in Next.js & NestJS
Ahmed Megahd
Snappy UI needs no Single-Page Application
Clemens Helm
WeAreDevelopers LIVE – AI vs the Web & AI in Browsers
Chris Heilmann, Daniel Cranney & Raymond Camden
WeAreDevelopers LIVE – Frontend Inspirations, Web Standards and more
Chris Heilmann, Daniel Cranney & Jan Deppisch
Develop AI-powered Applications with OpenAI Embeddings and Azure Search
Rainer Stropek
Wasm Deep Dive - A Glance Behind the Scenes
Rainer Stropek
Catching up on the basics you don't really need that much code
Chris Heilmann
The Eventloop in JavaScript - How does it work?
Christian Woerz
Related Articles
View all articles



From learning to earning
Jobs that call for the skills explored in this talk.

Code Healers LLC
Hinesville, United States of America
Remote
€30-40K
Intermediate
Senior
.NET
React
JavaScript
+2

Visonum GmbH
Remote
Junior
Intermediate
React
Redux
TypeScript

ROSEN Technology and Research Center GmbH
Osnabrück, Germany
Senior
React
DevOps
Next.js
TypeScript
Cloud (AWS/Google/Azure)

Almedia
Berlin, Germany
€85-100K
Senior
NestJS
Node.js
Express
TypeScript
+1

Client Server
Sunderland, United Kingdom
Remote
£70K
React
.NET Core
JavaScript
+2


Client Server
Leeds, United Kingdom
Remote
£100K
Redis
React
Kafka
+7

Client Server
Sunderland, United Kingdom
Remote
£40-50K
Redis
React
Docker
+5

Client Server
Charing Cross, United Kingdom
Remote
£100-130K
C++
Java
Elixir
+1