Colin Law wrote in post #1182193:
> On 14 March 2016 at 16:15, Bigmac Turdsplash <li...@ruby-forum.com>
> wrote:
>>
>> As for a button to trigger the event, ill have to make due with a
>> href=>/liveStream-hiWorld.ntml.erb
>
> Please quote the message you are replying to, this is a mailing list
> not a forum (though you may be accessing it via a forum like
> interface) so it is not clear to what you are replying.  Thanks.
>
> You specifically requested that the script be embedded in the the web
> page.  Your example is just live streaming from the controller.
>
> I don't think that href will work very well.  If you look for examples
> of using the live feature you will find how to stream into your web
> page.
>
> Colin

/messaging/index.html.erb
<script> source = new EventSource("/messaging");
source.addEventListener("message", function(response) {
// Do something with response.data
}, false);
 </script>

Im using the actioncontroller::live example found on the domentation 
site, i have things setup properly with routes.rb...
I can successfully append data to a <div> in the clients browser.
But the browser will keep streaming in a endless loop. Maybe this is 
expected behaviour?

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-talk+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/c64b63e124ecc06f75039563a8c976f7%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to