Hello, (shamelessly adapted to my needs from a old message from this list) I want to integrate status messages over xmpp in my Rails application. My problem is that I do not want to establish a connection to the jabber server each time a message is sent and disconnect the connection afterwards. So I am looking for a solution to establish the connection and use this connection in my controllers when I need it. I am going to use xmpp4r to communicate with the jabber network. How can I use the connection im my controllers? Will there be some issues about multiple application instances (because of FastCGI, Mongrel, etc.) ? With best regards, Mickael --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2007-Dec-12 10:02 UTC
Re: Establish Connection to a xmpp server and keep it !
On 12 Dec 2007, at 09:43, MickTaiwan wrote:> > Hello, > > (shamelessly adapted to my needs from a old message from this list) > > I want to integrate status messages over xmpp in my Rails application. > My problem is that I do not want to establish a connection to the > jabber server each time a message is sent and disconnect the > connection afterwards. So I am looking for a solution to establish the > connection and use this connection in my controllers when I need it. I > am going to use xmpp4r to communicate with the jabber network. > > How can I use the connection im my controllers? >You''re going to some sort of persistent process to maintain this. Call this an xmpp daemon, it will be the process (not a mongrel or fastcgi instance) in charge of talking to the jabber server(s). You then need to decide how you''re going to talk to this process. You could use drb, you could have a table in the database that this process looks at (something like a ''pending_status_updates'' table), etc.... You might also want to look at the latest version of backgroundrb, the advantage there is that they''ve figured out communication etc... for you. Fred> Will there be some issues about multiple application instances > (because of FastCGI, Mongrel, etc.) ? > > With best regards, > Mickael > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Nathan Esquenazi
2007-Dec-12 16:32 UTC
Re: Establish Connection to a xmpp server and keep it !
I don''t know if I am the lucky post you adapted but I posted something similar a while back. I am still working on that project now. I am using XMPP4R to communicate with a Jabber server we are running. It is a rails application and I am using Drb to communicate with the Jabber server persistently. It works pretty well. Feel free to email me - xgamerx10 (at) gmail (dot) com if you have any specific questions or want to talk about it. -- 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 -~----------~----~----~----~------~----~------~--~---
Thanks Frederick for your reply, it is exactly what I needed to know (do I have to keep the connection outside my controller, the answer is yes). Nathan, the post I adapted is from alexander at kueken.net http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6e054869c5e09eb1/ Thanks for your help. I will play a bit with backgroundrb, and implement a worker to keep xmpp connections. Mickael. --~--~---------~--~----~------------~-------~--~----~ 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''ve taken this approach (creating an XMPP worker in BackgroundRB). In my case, I need a proxy for many users on our sites, so this middle- ware needs to pool many connections to jabber servers and let the Rails app poll for data once in a while (for things like presence updates). BackgroundRB is going through major changes right now, but making fast progress, so it is worth checking out and getting on the mailing list. There have been a number of threads on this topic http://railsforum.com/ too. If others are working on Jabber/XMPP middle layers, it would be great to compare notes. -chris On Dec 12, 1:27 pm, MickTaiwan <faiv...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks Frederick for your reply, it is exactly what I needed to know > (do I have to keep the connection outside my controller, the answer is > yes). > > Nathan, the post I adapted is from alexander at kueken.nethttp://groups.google.com/group/rubyonrails-talk/browse_thread/thread/... > > Thanks for your help. > > I will play a bit with backgroundrb, and implement a worker to keep > xmpp connections. > > Mickael.--~--~---------~--~----~------------~-------~--~----~ 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 Dec 13, 8:11 am, chaupt <cfhdistantea...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If others are working on Jabber/XMPP middle layers, it would be great > to compare notes.or source code ? :-) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, Dec 13, 2007 2:57 AM, MickTaiwan <faivrem-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thanks Frederick for your reply, it is exactly what I needed to know > (do I have to keep the connection outside my controller, the answer is > yes). > > Nathan, the post I adapted is from alexander at kueken.net > http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6e054869c5e09eb1/ > > Thanks for your help. > > I will play a bit with backgroundrb, and implement a worker to keep > xmpp connections.Hey there, With latest version of BackgrounDRb you can have tcp connections integrated within event loop of your worker. Your worker would hold the connection and you can pass messages to worker from rails easily. The capability is already there, not just documented on how to have tcp client/server connections from a bdrb worker. But this I have rectified. Ping me on bdrb mailing list, I would be glad to help you out on this. -- Let them talk of their oriental summer climes of everlasting conservatories; give me the privilege of making my own summer with my own coals. http://gnufied.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---