https://github.com/rcarubbi/nodejs-server-sent-events-example
An simple example showing how to user server sent events with node.js
https://github.com/rcarubbi/nodejs-server-sent-events-example
nodejs server-sent-events
Last synced: 3 months ago
JSON representation
An simple example showing how to user server sent events with node.js
- Host: GitHub
- URL: https://github.com/rcarubbi/nodejs-server-sent-events-example
- Owner: rcarubbi
- Created: 2018-03-07T05:38:19.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-20T16:28:50.000Z (over 7 years ago)
- Last Synced: 2025-07-04T20:56:46.082Z (3 months ago)
- Topics: nodejs, server-sent-events
- Language: JavaScript
- Size: 6.84 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# nodejs-server-sent-events-example
## An simple example showing how to user server sent events with node.js> Server Sent Events are a good option instead WebSockets when you just need one-way data flow (server to client)
> They are based in Http protocol and are much simplier than WebSockets Protocol.### So, Let's get started!
1. Don't forget to run `npm install` before launch this project.
2. Launch the server typing `node server.js`
3. Open your browser and call `localhost:8080` to see the magic!### Some notes...
If you inspect the code you will see that the client initializes the EventSource (SSE Client) passing "/sse" in the constructor.
This is the default path setted on SSE component in the server. Obviously you can override it if you want passing the path parameter in the SSE constructor on the server side.