@snek/sse
v1.0.0
Published
SSE for http and http2
Downloads
1
Readme
SSE
Easy SSE for http and http2
const sse = require('sse');
require('http').createServer((req, res) => {
const c = sse(res);
setInterval(() => {
c.send('time', Date.now());
}, 1000);
}).listen(80);
// OR
require('http2').createSecureServer({
key: ...
cert: ...
}).on('stream', (stream) => {
const c = sse(stream);
setInterval(() => {
c.send('time', Date.now());
}, 1000);
}).listen(443);