On 16 March 2016 at 01:24, Bigmac Turdsplash <li...@ruby-forum.com> wrote: > Bigmac Turdsplash wrote in post #1182233: >> 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? > > ensure > response.stream.close
Can you copy/paste the code you are using to do the streaming in the controller please. Colin -- 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/CAL%3D0gLtyLmr%2BA%3D6rE1Xa_SM4s321UtTUiqMR2GheexpHBng_rA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.