Code Monkey home page Code Monkey logo

rails-and-server-sent-events's Introduction

Rails 4 ActionController::Live and HTML5 Server Sent Events

Using Browser feature SSE to retrieve changes on a Rails4 application stream

Steps

  1. rails 4.0.0 new
  2. Add Puma server, witch support Server Sent Events: http://puma.io/
  3. Allow concurrency on development enviroment
  4. Add helper to write on stream
  5. Scaffold a model to use on live test
  6. Add stream capability to UsersController, using ActionController::Live
  7. Provide stream, of last user changed, on UsersController and consumes using HTML5 Server Sent Event

How to see it working

  1. git clone https://github.com/acdesouza/rails-and-server-sent-events.git .
  2. bundle install
  3. bundle exec rake db:create db:migrate
  4. bundle exec rails s
  5. On Browser 1: User watch stream
  6. On Browser 2: User watch stream
  7. On Browser 3: User list
  8. Redimension browser's windows to make browser visible
  9. On Browser 3: Create an user
  10. On Browser 1,2: See they receiving the update

Fonts

rails-and-server-sent-events's People

Contributors

acdesouza avatar epigene avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.