No description, website, or topics provided.
JavaScript CSS HTML
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is an example of a node.js HTML5 Server Sent Events notifications server that sends real-time notifications to connected browsers (think site editors/administrators) about code deployment statuses.

The server consists of two components

  1. /rcvstatus Receives notifications from Jenkins and broadcasts it to connected browsers. You can use the Notifications plugin on Jenkins to post JSON to this server to notify of build status.

  2. /ssestatus Receives and manages connections from browsers. In this example, we manage a multi-site scenario. So it keeps an array of existing connections by sitename. It is expected that the Jenkins job is parameterized to include the sitename so as to match the job with the list of connected sites to broadcast to.

Client side

The client-side JavaScript implements a straightforward EventSource connection. It includes an EventSource polyfill ( to ensure compatibility and the notifications are displayed using humane.js. The client JS and CSS are in the dist/ folder.

A new version of the client script uses a standalone library. This supports asynchronous loading and execution and does not depend on jQuery or jQuery notify. This script and its CSS can be found in the dist/ folder.

Async loading

Load the CSS

<link rel="stylesheet" href="//">

Load the client

<!-- // Load via a standard script tag -->
<script async src="//"></script>

<!-- // Or a compatible snippet -->
  var a=document.createElement("script"); var b=document.getElementsByTagName('script')[0];

Initialise the code

  var sseClient = sseClient || {}; sseClient.q = sseClient.q || [];
  sseClient.q.push(['connect', {url: ''}]);

How to use:

  1. Install node.js and npm -
  2. Download this repo.
  3. Optionally set the PORT env variable.
  4. Optionally also set the MAPFILE env variable if you would like to provide a mapping file (in JSON format) to additional urls to be notified. Sample format: { "key1" : ["url1a", "url1b"], "key2" : ["url2a", "url2b", "url2c"] } NOTE: This is useful in a scenario where for example an auth site may have multiple url aliases where editors could be working from.
  5. Start the app: node app.js
  6. Setup your Jenkins (deployment) job to notify your server ( using JSON over HTTP.
  7. Add a parameter to the Jenkins job to set the "Site" for which the task needs to notify.
  8. Now assuming your site editors are running the above client-side JS, whenever a site deployment is triggered, they would get a notification.