{"id":18720510,"url":"https://github.com/dennisinteractive/sse-jenkins","last_synced_at":"2025-08-01T07:34:46.520Z","repository":{"id":146540738,"uuid":"116123101","full_name":"dennisinteractive/sse-jenkins","owner":"dennisinteractive","description":null,"archived":false,"fork":false,"pushed_at":"2018-01-03T11:06:18.000Z","size":4101,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":42,"default_branch":"master","last_synced_at":"2025-05-19T14:52:25.716Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dennisinteractive.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.txt","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-01-03T10:16:47.000Z","updated_at":"2018-01-03T14:31:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"ffecb709-21aa-4fe8-a3d2-82b76a46da15","html_url":"https://github.com/dennisinteractive/sse-jenkins","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/dennisinteractive/sse-jenkins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennisinteractive%2Fsse-jenkins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennisinteractive%2Fsse-jenkins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennisinteractive%2Fsse-jenkins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennisinteractive%2Fsse-jenkins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dennisinteractive","download_url":"https://codeload.github.com/dennisinteractive/sse-jenkins/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennisinteractive%2Fsse-jenkins/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268185560,"owners_count":24209392,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T13:31:24.346Z","updated_at":"2025-08-01T07:34:46.510Z","avatar_url":"https://github.com/dennisinteractive.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"sse-jenkins\n===========\n\nThis 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.\n\nThe server consists of two components\n-------------------------------------\n\n1. /rcvstatus Receives notifications from Jenkins and broadcasts it to connected browsers. You can use the Notifications plugin https://wiki.jenkins-ci.org/display/JENKINS/Notification+Plugin on Jenkins to post JSON to this server to notify of build status.\n\n2. /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.\n\nClient side\n-----------\n\nThe client-side JavaScript implements a straightforward EventSource connection. It includes an EventSource polyfill (https://github.com/Yaffle/EventSource) to ensure compatibility and the notifications are displayed using [humane.js](https://github.com/wavded/humane-js). The client JS and CSS are in the `dist/` folder.\n\nA 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.\n\n#### Async loading\n\nLoad the CSS\n\n```html\n\u003clink rel=\"stylesheet\" href=\"//www.example.com/sse-client.css\"\u003e\n```\n\nLoad the client\n\n```js\n\u003c!-- // Load via a standard script tag --\u003e\n\u003cscript async src=\"//www.example.com/sse-client.min.js\"\u003e\u003c/script\u003e\n\n\u003c!-- // Or a compatible snippet --\u003e\n\u003cscript\u003e\nsetTimeout(function(){\n  var a=document.createElement(\"script\"); var b=document.getElementsByTagName('script')[0];\n  a.src=document.location.protocol+\"//www.example.com/sse-client.min.js\";\n  a.async=true;a.type=\"text/javascript\";b.parentNode.insertBefore(a,b)\n},1);\n\u003c/script\u003e\n```\n\nInitialise the code\n\n```js\n\u003cscript\u003e\n  var sseClient = sseClient || {}; sseClient.q = sseClient.q || [];\n  sseClient.q.push(['connect', {url: 'http://your-sse-server.com:8090/ssestatus'}]);\n\u003c/script\u003e\n```\n\nHow to use:\n-----------\n\n1. Install node.js and npm - http://www.joyent.com/blog/installing-node-and-npm\n2. Download this repo.\n3. Optionally set the PORT env variable.\n4. 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:\n{\n  \"key1\" : [\"url1a\", \"url1b\"],\n  \"key2\" : [\"url2a\", \"url2b\", \"url2c\"]\n}\nNOTE: This is useful in a scenario where for example an auth site may have multiple url aliases where editors could be working from.\n5. Start the app: node app.js\n6. Setup your Jenkins (deployment) job to notify your server (http://yourserver.com:port/rcvstatus) using JSON over HTTP.\n7. Add a parameter to the Jenkins job to set the \"Site\" for which the task needs to notify.\n7. Now assuming your site editors are running the above client-side JS, whenever a site deployment is triggered, they would get a notification.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennisinteractive%2Fsse-jenkins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdennisinteractive%2Fsse-jenkins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennisinteractive%2Fsse-jenkins/lists"}