On 14 Feb 2012, at 13:10, Jedrin wrote:

You could use pushing from the server instead of 
polling.http://railscasts.com/episodes/260-messaging-with-faye

I'll add another railscast that appeared a few weeks later that might
make implementing a push server even 
easier:http://railscasts.com/episodes/316-private-pub

What is the basic concept here ? Is this standard HTML/Javascript ?
Everything in HTTP seems counter to that I have seen, so I am missing
something ?

Web technology has advanced quite a bit over the years. One feature of HTML5 is Websockets, which allow a persistent connection with the server and thus allowing the server to push data to the client without any client interaction or workarounds like polling with a certain interval.

Frameworks like Faye use Websockets when available and fall back to alternative methods for older browsers (a Flash-based socket or long polling, which is not the same as interval polling).

Simply put (it's actually a bit more complex) the following happens:
- User loads the page
- Javascript opens a persistent socket to the Faye server (using a named channel if you want it to) - From your Rails app, you send messages to the Faye server, which automatically distributes it to all client connections for that particular channel.

The Railscasts explain the concept quite nicely IIRC.


Best regards

Peter De Berdt

--
You received this message because you are subscribed to the Google Groups "Ruby on 
Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to