Skip to content
Using Server-Sent Events (SSE) in Ruby on Rails example
Ruby HTML JavaScript CSS
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
bin
config
db
lib
log
public
tmp
vendor
.gitignore
.ruby-version
Gemfile
Gemfile.lock
README.md
Rakefile
config.ru

README.md

Using Server-Sent Events (SSE) in Ruby on Rails example

Goals

  • Consider ways to process SSE connections in Ruby On Rails application
  • Show how using Rack Hijacking API allows to avoid blocking web server threads

For more information read this article

Approaches

  • ActionController::Live
  • Rack Hijacking API (Full hijacking)
  • Rack Hijacking API (Partial hijacking)

Setting Puma threads count

Change default value in 'config/puma.rb' file

threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }

Or set RAILS_MAX_THREADS env variable when starting Rails server

RAILS_MAX_THREADS=5 rails s

You can’t perform that action at this time.