An open API service indexing awesome lists of open source software.

https://github.com/makevoid/sinatra_sse_example

Sinatra example using EventSource (Server Sent Events)
https://github.com/makevoid/sinatra_sse_example

Last synced: 9 months ago
JSON representation

Sinatra example using EventSource (Server Sent Events)

Awesome Lists containing this project

README

          

## Sinatra-stream Example

Sinatra example using EventSource (Server Sent Events)

Original code from:

Server Sent Events are an awesome api that lets you push data asynchronously directly to your clients.

A polyfill for EventSource is available (thanks IE), please check:

### Setup:

gem i bundler

bundle

(you need to have Redis installed)

On ubuntu you can install redis by:

apt-get install redis-server

# Run:

bundle exec rackup

# Usage:

Open

Then from your console:

redis-cli publish message hello

Voila', you shoul see your message in every browser window you have open.