Skip to content

Instantly share code, notes, and snippets.

@anthonyringoet
Created July 28, 2018 10:53
Show Gist options
  • Save anthonyringoet/53f68fcaba6dbf38564222130ed4794e to your computer and use it in GitHub Desktop.
Save anthonyringoet/53f68fcaba6dbf38564222130ed4794e to your computer and use it in GitHub Desktop.

Revisions

  1. anthonyringoet created this gist Jul 28, 2018.
    11 changes: 11 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    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)
    }