Server-Sent Events (SSE) allow servers to push real-time notifications to web clients over HTTP. This project demonstrates a basic SSE implementation
+-------------+ Event Stream +--------------+
| | -----------------------> | |
| Server | | Browser |
| | <----------------------- | |
+-------------+ HTTP Request +--------------+
- Server: Sends real-time updates to the client
- Browser: Listens for incoming events and processes them to update the UI
- Simple & Resource Efficient (Lightweight)
- Native in Browser
- Suitable for One-way Notification
- Node.js (for Backend)
- Live Server (Extension for Frontend)
- A modern web browser that supports SSE (e.g., Google Chrome, Firefox, Safari, Microsoft Edge, etc.)
Clone the repository:
git clone https://github.com/ardwiinoo/server-send-eventsNavigate to the project directory
cd ./server-send-eventsInstall dependencies:
cd ./backendpnpm install- To run the frontend, use
Live Server - To run the backend, use the
pnpm run devcommand in the terminal