Crash Course: Server-Sent Events (SSE) with Express.js & EventSource

Published: 25 June 2024
on channel: Coding With Adam
3,920
125

In this tutorial, we will dive into the world of Server-Sent Events (SSE) with a hands-on approach. I will guide you through setting up an Express.js server to handle SSE events and creating a simple HTML and JavaScript frontend to manage SSE event streams using EventSource.

🔍 What You'll Learn:
Setting up an Express.js server for SSE
Handling SSE event streams with EventSource in JavaScript
Building a basic client-side implementation with HTML and JS

📚 Resources & Links:
Code
https://github.com/CodingWith-Adam/ss...
MDN Event Source
https://developer.mozilla.org/en-US/d...

If you enjoy this tutorial please subscribe, like and share

Chapters
00:00 Intro
00:16 HTTP vs SSE
01:15 Project Setup
02:44 Express.js Setup
03:27 SSE Endpoint
03:46 SSE Endpoint Headers
05:33 SSE Endpoint Send Example Data
06:42 SSE Endpoint Send Current Time
7:57 Client Setup
09:34 EventSource onMessage
11:18 EventSource addEventListener
11:59 SSE How to add Events Server Side
13:31 SSE EventSource Client Side addEventListener for Color


Watch video Crash Course: Server-Sent Events (SSE) with Express.js & EventSource online, duration hours minute second in high quality that is uploaded to the channel Coding With Adam 25 June 2024. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 3,920 times and liked it 125 visitors.