Skip to content

Express middleware to push events/messages from the server to the browser, using EventSource.

License

Notifications You must be signed in to change notification settings

zacbarton/node-server-sent-events

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

server-sent-events

Express middleware to push events/messages from the server to the browser, using EventSource.

This middleware will keep the request stream open indefinitely, pad the initial response stream for IE and flush the response if the compression middleware is in use.

Detailed information on how to setup the browser/client can be found here.

Installation

$ npm install -g server-sent-events

Usage (with express)

// require sse
var sse = require('server-sent-events');
var express = require('express');

var app = express();

app.get('/events', sse, function(req, res) {
	// res.sse is made available via the middleware
	res.sse('data: im from the server\n\n');
});

About

Express middleware to push events/messages from the server to the browser, using EventSource.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published