Socket
Book a DemoInstallSign in
Socket

co-sse

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

co-sse

Server-Sent Events generator stream

latest
npmnpm
Version
0.0.0
Version published
Maintainers
1
Created
Source

co-sse

Server-Sent Events generator stream

Example

Create a sse stream from a function:

var sse = require('co-sse');
var wait = require('co-wait');
var co = require('co');

co(function*(){
  var read = sse(function*(){
    yield wait(1000);
    return Date.now() + '';
  });

  var data;
  while (data = yield read) console.log(data);
})();

Outputs:

$ make example
data: 1391517447428


data: 1391517448462


data: 1391517449464


data: 1391517450466


data: 1391517451467


Installation

$ npm install co-sse

API

sse(fn[, opts])

Create a generator function that reads and converts data from fn into the Server-Sent Events format.

Options:

  • retry: Set the retry interval

License

MIT

FAQs

Package last updated on 04 Feb 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts