Hi all, I am newly learning Rails and playing with Web Chat app. I looked through what other people have done. I tested the following very naive, skeleton app. It seems to work in my local machine when I open two Firefox (or two Safari). But it does not work cross browser, eg, Firefox-Safari. Strange? What''s going on? Thanks. - index.rhtml <% form_remote_tag :url => {:action => ''say''} do %> <%= text_field_tag ''said'' %> <%= submit_tag ''Say'' %> <% end %> <%= periodically_call_remote :url => {:action => ''get_new_line'' }, :frequency => 1.0 %> - chat_controller.rb def say session[:what_said] = params[:said] @line1 = session[:what_said] end def get_new_line @line2 = session[:what_said] end - say.rhtml <%= @line1 %> - get_new_line.rhtml <%= @line2 %> --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I would recommend going against the Rails option here as you''re making a request at least once every second to an action in your application. Imagine if 10 people were in the chat, that would mean 10 requests per second. Think of an alternative option here, like an IRC server or similar. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 09 Feb 2008, at 08:01, Ryan Bigg wrote:> I would recommend going against the Rails option here as you''re > making a > request at least once every second to an action in your application. > Imagine if 10 people were in the chat, that would mean 10 requests per > second. > > Think of an alternative option here, like an IRC server or similar.Campfire does it, so it does work when done right. You could have a look at juggernaut, does use a flash file and extra process running on the server. http://juggernaut.rubyforge.org/ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yea just wanted to second the juggernaut option. I am using it and it works great. -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 9 Feb 2008, at 05:58, Sy wrote:> > Hi all, > > I am newly learning Rails and playing with Web Chat app. I looked > through what other people have done. I tested the following very > naive, skeleton app. It seems to work in my local machine when I open > two Firefox (or two Safari). But it does not work cross browser, eg, > Firefox-Safari. Strange? What''s going on? Thanks. > > - index.rhtml > <% form_remote_tag :url => {:action => ''say''} do %> > <%= text_field_tag ''said'' %> > <%= submit_tag ''Say'' %> > <% end %> > > <%= periodically_call_remote :url => {:action => > ''get_new_line'' }, :frequency => 1.0 %> > > - chat_controller.rb > def say > session[:what_said] = params[:said] > @line1 = session[:what_said] > end > > def get_new_line > @line2 = session[:what_said] > endAre you storing everything in the session ? The session will be stored per user (ie per browser) so it''s not surprising it doesn''t work. Fred --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hmm, I see. I guess everything has to be stored in models. Thanks. On Feb 9, 4:16 am, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 9 Feb 2008, at 05:58, Sy wrote: > > > > > > > Hi all, > > > I am newly learning Rails and playing withWebChatapp. I looked > > through what other people have done. I tested the following very > > naive, skeleton app. It seems to work in my local machine when I open > > two Firefox (or two Safari). But it does not workcrossbrowser, eg, > > Firefox-Safari. Strange? What''s going on? Thanks. > > > - index.rhtml > > <% form_remote_tag :url => {:action => ''say''} do %> > > <%= text_field_tag ''said'' %> > > <%= submit_tag ''Say'' %> > > <% end %> > > > <%= periodically_call_remote :url => {:action => > > ''get_new_line'' }, :frequency => 1.0 %> > > > - chat_controller.rb > > def say > > session[:what_said] = params[:said] > > @line1 = session[:what_said] > > end > > > def get_new_line > > @line2 = session[:what_said] > > end > > Are you storing everything in the session ? The session will be stored > per user (ie perbrowser) so it''s not surprising it doesn''t work. > > Fred--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yeah, I should try Juggernaut. But I wonder if my web host will allow push server stuff. Thanks. On Feb 9, 2:01 am, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> On 09 Feb 2008, at 08:01, Ryan Bigg wrote: > > > I would recommend going against the Rails option here as you''re > > making a > > request at least once every second to an action in your application. > > Imagine if 10 people were in the chat, that would mean 10 requests per > > second. > > > Think of an alternative option here, like an IRC server or similar. > > Campfire does it, so it does work when done right. > > You could have a look at juggernaut, does use a flash file and extra > process running on the server. > > http://juggernaut.rubyforge.org/ > > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sly - On 9-Feb-08, at 3:47 PM, Sy wrote:> > Yeah, I should try Juggernaut. But I wonder if my web host will allow > push server stuff. > Thanks. > >if you''re not adverse to having your chat scripts being stored on a public service lingr.com can be integrated easily in a day. I''ve had nice success making private password protected chat rooms for a community using lingr. You can find docs on their blog, etc. cheers, Jodi --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
And a third from me. I met the developer of Juggernaut at RailsConf and saw a demo. Very slick. It uses a small flash object to keep a persistent connection open between client and server so you eliminate a lot of issues there. From a development perspective it was basically as simple as saying "open chat channel 9" (work out the details for your app) and then the client/browser just listens. Another option, if you''re shopping, is Jabber. I was leaning towards this until I ran into Juggernaut. Good luck, AndyV On Feb 9, 5:32 am, Nathan Esquenazi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Yea just wanted to second the juggernaut option. I am using it and it > works great. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 10, 2008 3:43 PM, AndyV <arv7-HmMyXyqgL2CVc3sceRu5cw@public.gmane.org> wrote:> > And a third from me. I met the developer of Juggernaut at RailsConf > and saw a demo. Very slick. It uses a small flash object to keep a > persistent connection open between client and server so you eliminate > a lot of issues there. From a development perspective it was > basically as simple as saying "open chat channel 9" (work out the > details for your app) and then the client/browser just listens. > > Another option, if you''re shopping, is Jabber. I was leaning towards > this until I ran into Juggernaut. > > > Good luck, > AndyV > > On Feb 9, 5:32 am, Nathan Esquenazi <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > Yea just wanted to second the juggernaut option. I am using it and it > > works great. > > -- > > Posted viahttp://www.ruby-forum.com/.Jabber is a communication protocol. You''ll still need a Comet (official term) implementation like Juggernaut to push chats out to the user or do polling like Gmail''s in-browser chat client does (IIRC), Jason --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Right, Jabber won''t allow a persistent connection without some "comet" alternative. I already advocated Juggernaut but here is another alternative: http://shooting-star.rubyforge.org/wiki/wiki.pl?Making_A_Chat_System_Within_5_Minutes That is using a more standard comet implementation called shooting_star. Like Juggernaut, it opens a persistent connection which can be used for implementing a chat system. I have looked at both and I chose Juggernaut but it easily could have been the wrong decision. However, juggernaut was so easy to use and it worked so I had no reason to move away from it. As long as the browser has Flash, it works like a charm. -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you all for great suggestions! In fact, I installed Juggernat today. I followed its README file example included below. It works, but whenever Rails call is made, alert window ( "Juggernaut: Received data: try { ... " ) pops up all the time. How can I block this? -chat controller: class ChatController < ApplicationController def index end def send_data render :juggernaut do |page| page.insert_html :top, ''chat_data'', "<li>#{h params[:chat_input]}</li>" end render :nothing => true end end -index.rhtml <html> <head> <%= javascript_include_tag :defaults, :juggernaut %> <%= juggernaut %> </head> <body> <%= form_remote_tag( :url => { :action => :send_data }, :complete => "$(''chat_input'').value = ''''" ) %> <%= text_field_tag( ''chat_input'', '''', { :size => 20, :id => ''chat_input''} ) %> <%= submit_tag "Add" %> </form> <ul id="chat_data" style="list-style:none"> </ul> </body> </html> On Feb 10, 4:13 pm, Nathan Esquenazi <rails-mailing-l...@andreas- s.net> wrote:> Right, Jabber won''t allow a persistent connection without some "comet" > alternative. I already advocated Juggernaut but here is another > alternative: > > http://shooting-star.rubyforge.org/wiki/wiki.pl?Making_A_Chat_System_... > > That is using a more standard comet implementation called shooting_star. > > Like Juggernaut, it opens a persistent connection which can be used for > implementing achatsystem. > > I have looked at both and I chose Juggernaut but it easily could have > been the wrong decision. However, juggernaut was so easy to use and it > worked so I had no reason to move away from it. As long as thebrowser > has Flash, it works like a charm. > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Yea, I get that too. It only happens in development (on your local PC). It is for your debugging purposes. Once deployed to the server, these messages are not displayed. (Make sure on the server, the juggernaut config file is set to production mode). -- 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 post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---