Phusion Passenger: HTML5 Server Side Events demo (Ruby version)
Ruby
Switch branches/tags
Nothing to show
Latest commit 67db15c Sep 24, 2013 @FooBarWidget FooBarWidget Fix terminology
Permalink
Failed to load latest commit information.
public Initial commit Aug 19, 2013
tmp Initial commit Aug 19, 2013
.gitignore Initial commit Aug 19, 2013
Gemfile Initial commit Aug 19, 2013
Gemfile.lock Initial commit Aug 19, 2013
LICENSE.txt Initial commit Aug 19, 2013
README.md Fix terminology Sep 24, 2013
config.ru Apparently event stream messages are separated by LFLF, not CRLFCRLF Aug 19, 2013

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.