larryzhao
larryzhao

Reputation: 3213

Example on implementing HTML5 Server Side Event in Rails 3.2

I am trying to introduce HTML5 Server-Side-Event to my Rails 3.2 project. I did some search at Google.com, but most of the examples are using php. There's only one example on Rails that is using Goliath, and I am not using that.

I am using Thin in my development and deploying with passenger. I think it's valid for doing text streaming for SSE. Is there any examples on Rails 3.2 for reference?

Upvotes: 11

Views: 2176

Answers (3)

Braden
Braden

Reputation: 1558

Rails 4.0 is implementing SSE, upgrading your rails and implementing SSE via rails 4.0 ActiveController::Live is probably the best option.

Otherwise you may be stuck with a less stable/performant/maintained option such as Juggernaut or other frameworks.

Source :
http://ngauthier.com/2013/02/rails-4-sse-notify-listen.html http://edgeguides.rubyonrails.org/4_0_release_notes.html#railties-notable-changes

Upvotes: 4

Eskim0
Eskim0

Reputation: 834

This isn't exactly HTML 5 Server Side Events but it is a tried and true method to accomplish essentially the same. To push from the server to the client, in the past a lot of people including myself have used the Juggernaut gem (https://github.com/maccman/juggernaut - runs on top of node.js). A little different than Server Side Events but perhaps more time tested. The gem is still being updated it seems.

Upvotes: 0

kals
kals

Reputation: 190

You can check out 'Cramp' gem - http://cramp.in/

It's having built in support for HTML5 tehcnologies - WebSockets and SSE

Upvotes: 2

Related Questions