sses-node-example
sses-node-example copied to clipboard
Example of Express.js application providing Server-Sent Events (SSEs) on top of Redis pub/sub connection
Server-Sent Events (SSEs), Node.js (Express.js), and Redis
This is an example application demonstrating one way to approach delivering Server-Sent Events with Node.js (leveraging Express.js).
The application accompanies a blog post at: http://tomkersten.com/articles/server-sent-events-with-node/
Requirements
- Redis
- Node.js
- Express.js
Using it...
- Clone the repo locally
- cd into the cloned directory and run
node app.js - Visit http://localhost:8000/ in one browser window (Page A)
- Open another window and visit http://localhost:8000/fire-event/anything-you-want-here (Page B)
- Look at 'Page A' again...and you should see a message including the name of the page you
visited ('anything-you-want-here')
- Additionally, if you open up
redis-cliand issuePUBLISH updates 'some message here', you should see your message show up as well.
- Additionally, if you open up