
Research
Security News
The Landscape of Malicious Open Source Packages: 2025 Mid‑Year Threat Report
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
sse-express
Advanced tools
Server Sent Events middleware implementation for express
npm install --save sse-express
The package requires express
, because it was created directly for the framework. Also it utilizes ES6
features, so be sure that node
v5.0+ is installed.
Use it simply a middleware for any of your routes. When is used as middleware method sse()
is added to response object of the route. You can use it to send messages to a client.
let sseExpress = require('./sse-express');
//...
app.get('/updates', sseExpress, function(req, res) {
res.sse('connected', {
welcomeMsg: 'Hello world!'
});
});
At the client side you can listen to message through EventSource
instance:
let eventSource = new EventSource('http://localhost:80/updates');
eventSource.addEventListener('connected', (e) => {
console.log(e.data.welcomeMsg);
// => Hello world!
});
Important! Don't forget to check out browser compatibility of
EventSource
. At the moment it doesn't implemented in any versions of IE.
Every 3 seconds a handshake message will be sent to the client to not allow a browser lose a connection. Handshake message is just a comment that will not be caught by any of EventSource
's events.
EventSource
evt
- is event name
json
- object that will be sent as json string to a client
[id]
- optional id of event
FAQs
Server sent events middleware implementation for expressjs
We found that sse-express demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A look at the top trends in how threat actors are weaponizing open source packages to deliver malware and persist across the software supply chain.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.