Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Phusion Passenger: HTML5 Server Side Events demo (Ruby version)
Ruby
branch: master
Failed to load latest commit information.
public Initial commit
tmp Initial commit
.gitignore Initial commit
Gemfile Initial commit
Gemfile.lock Initial commit
LICENSE.txt Initial commit
README.md Fix terminology
config.ru Apparently event stream messages are separated by LFLF, not CRLFCRLF

README.md

Phusion Passenger Server Sent Events demo

This app demonstrates Phusion Passenger's support for HTML5 Server Sent Events. Every second, the server sends us a random number. The app repeats sends at most 5 numbers per connection, but the browser keeps querying the server so the EventStream is infinite.

Getting started

bundle install
gem install passenger
passenger start

Then visit http://127.0.0.1:3000/

Compatibility

  • This app uses plain Rack, and thus is framework agnostic.
  • Server Sent Events works on Phusion Passenger for Apache, Phusion Passenger for Nginx and Phusion Passenger Standalone.
  • At least version 4.0.5 of Phusion Passenger is required.

Multithreading and performance

Server Sent Events works great on both the open source variant of Phusion Passenger, as well as on Phusion Passenger Enterprise. For optimal performance, Phusion Passenger Enterprise with multithreading is recommended. You should use the following settings for enabling multithreading. The more concurrent users you have, the higher your thread count should be. As a rule, your thread count should be at least the number of Server Sent Event sessions you have.

Apache:

PassengerConcurrencyModel thread
PassengerThreadCount 64

Nginx:

passenger_concurrency_model thread
passenger_thread_count 64

Feedback

Please join the discussion forum if you have questions or feedback about this demo.

Something went wrong with that request. Please try again.