Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mirek/node-tiny-sse
Server Sent Events (SSE) for express/connect.
https://github.com/mirek/node-tiny-sse
Last synced: about 1 month ago
JSON representation
Server Sent Events (SSE) for express/connect.
- Host: GitHub
- URL: https://github.com/mirek/node-tiny-sse
- Owner: mirek
- License: mit
- Created: 2014-06-29T01:04:59.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-12-08T10:01:31.000Z (about 9 years ago)
- Last Synced: 2024-05-09T16:18:00.668Z (8 months ago)
- Language: CoffeeScript
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Summary
Server Sent Events (SSE) support for express/connect.
Why SSE and not WebSockets/socket.io? Because:
* it's based on pure HTTP
* works with elastic beanstalk load balancer, proxies like nginx, etc.
* it'll run your middleware chain normally in express/connect, just like for any other HTTP request (ie.
authentication, setting up locals etc.)
* you don't need to store any state, everything happens in stateless http request (no need for redis backed state,
even for load balanced environment)
* much simpler than WebSocketsWhat is it good for?
* any server generated push notifications
* one-off, long running tasks that you want to have progress indication for## Installation
npm install tiny-sse --save
## Usage
sse = require 'tiny-sse'
...
app.get '/foo/bar', sse.head(), sse.ticker(seconds: 15), (req, res) ->
sse.send(event: 'foo', data: 'Hello')(req, res)
req.end()