Skip to content

Instantly share code, notes, and snippets.

@anthonyringoet
Created July 28, 2018 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonyringoet/53f68fcaba6dbf38564222130ed4794e to your computer and use it in GitHub Desktop.
Save anthonyringoet/53f68fcaba6dbf38564222130ed4794e to your computer and use it in GitHub Desktop.
micro-sse-possible
module.exports = async (req, res) => {
res.writeHead(200, {
'Connection': 'keep-alive',
'Content-Type': 'text/event-stream',
'Cache-Control': 'no-cache'
});
setInterval(() => {
res.write({ foo: 'bar' });
}, 500)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment