https://github.com/queckezz/co-sse-events
Stream Server-Sent Events from an emitter
https://github.com/queckezz/co-sse-events
Last synced: 4 months ago
JSON representation
Stream Server-Sent Events from an emitter
- Host: GitHub
- URL: https://github.com/queckezz/co-sse-events
- Owner: queckezz
- Created: 2014-04-25T17:18:06.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-05-04T17:43:35.000Z (over 11 years ago)
- Last Synced: 2025-03-13T23:21:10.594Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 199 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# co-sse-events
A sse stream based on events. Wrap an `emitter` with this module to emit sse events.
## Installation
```bash
$ npm install co-sse-events
```## Example
Returns events in sequence based on the [sse spec](http://www.w3.org/TR/2009/WD-eventsource-20091029/)
```js
var emitter = new Emitter;var e;
while (e = yield sse(emitter)) {
console.log(e.out)
/* ->
* event: test
* data: { some: prop }
*
* ->
* event: test
* data: 'prop'
*/
}emitter
.emit('test', { some: prop })
.emit('test', 'prop')
```