A beginner-friendly example demonstrating how to implement Server-Sent Events (SSE) using Express.js. This project helps developers understand the basics of SSE and how it can be used for real-time data updates in a web application.
- Real-Time Data Updates: Use SSE to send updates from the server to the client without polling.
- Simple and Lightweight: Built with minimal dependencies to keep things straightforward.
- Beginner-Friendly: Clean and easy-to-understand codebase with comments.
Follow these steps to set up and run the project locally:
-
Clone the repository:
git clone https://github.com/amdsaad/sse-express-js.git
-
Navigate to the project directory:
cd sse-express-js
-
Install dependencies:
npm install
-
Start the server:
node app.js
-
Open
index.html
in your browser to see SSE in action.
- The
app.js
file contains a simple Express server that sends real-time updates to connected clients. - Open the
index.html
file in your browser to establish an SSE connection and receive data updates from the server.
For a detailed explanation of how this application works, refer to this blog post.
Contributions are welcome! Here's how you can get involved:
-
Fork the repository.
-
Create a new branch for your feature/bugfix:
git checkout -b feature-name
-
Make your changes and commit them:
git commit -m "Add new feature"
-
Push your changes to your fork:
git push origin feature-name
-
Open a pull request.
This project is licensed under the MIT License.
expressjs
sse
nodejs
backend
real-time-updates
For questions or feedback, feel free to reach out: