Example of Express.js application providing Server-Sent Events (SSEs) on top of Redis pub/sub connection
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
node_modules
public/stylesheets
routes
views
README.md
app.js
package.json

README.md

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

  1. Redis
  2. Node.js
  3. Express.js

Using it...

  1. Clone the repo locally
  2. cd into the cloned directory and run node app.js
  3. Visit http://localhost:8000/ in one browser window (Page A)
  4. Open another window and visit http://localhost:8000/fire-event/anything-you-want-here (Page B)
  5. Look at 'Page A' again...and you should see a message including the name of the page you visited ('anything-you-want-here')
    1. Additionally, if you open up redis-cli and issue PUBLISH updates 'some message here', you should see your message show up as well.