Natively Pronounced Mandarin

    @snek/sse

    1.0.0 • Public • Published

    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);

    Keywords

    none

    Install

    npm i @snek/sse

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • snek