UPDATED for BackgrounDRb 0.2.1
In this tutorial we are going to use a BackgrounDRb worker to hold an IM client. Our Rails app will then use BackgrounDRb to tell the IM client to send instant messages.
To help put this example in the context of a real-world application, let's imagine that we are working on a newspaper website. Whenever a new article is created we want to notify readers by sending them an Instant Message.
Let's roll
Let's get started by creating a small Rails application. I'm assuming you are familiar with using scaffolding to build CRUD functionality so we are going to go through this part quickly.
1) Create a Rails application called dailynews.
Last edited by bp (2006-12-11 04:22:34)
Offline
BackgrounDRb 0.2.0 was released today. A full rewrite. I haven't tried it out yet. Different svn repository so hopefully there won't be any problems installing the way I did above.
http://brainspl.at/articles/2006/10/30/ … 0-released
Offline
Very good tutorial!
Offline
thanx a lot for this great tutorial.
bp wrote:
Thanks! Glad you liked it. I was thinking of posting the code for people to play around with. If you (or anyone) is interested, let me know and I'll get it up somewhere.
yes please put it online somewher or send it to my email patcito at gmail dot com 
Offline
what if
1. saturn:/tmp/xmpp4r-0.3 bp$ irb
2. irb(main):001:0> require 'XMPP4R'
3. => true
4. irb(main):002:0> quit
does not work..!
error:
LoadError: no such file to load -- XMPP4R
Offline
Thanks danger! I hope you have a chance to play with it and I'd love to hear how it goes.
I made a tarball of the code without vendor/rails (trying to keep it small). Here it is for anyone that wants it.
http://www.bradpauly.com/code/dailynews.tar.gz
Offline
This is a great tutorial! I wish I had it when I started investigating XMPP and rails...
I recently started a series of posts about XMPP and ruby/rails. It's not tutorial style and goes a bit deeper in to the protocol and usage. So far I posted 3 parts:
1. Introduction
2. Logging in and sending simple messages
3. Adding rich text to messages
The third one deals with html in messages which is not really well documented outside of the standard documents, so I hope my post will help facilitate using it.
I'm also in the process of writing more posts about it, including queries, presence and using gateways to other services like YM, ICQ, AIM and MSN.
Offline
I'm glad you liked it. Great series you have too! I look forward to more.
Also a quick note on this tutorial. I received an email from Olle Jonsson, including line by line edits (thanks Olle!), letting me know that the latest version of BackgrounDRb, 0.2.1, includes some changes that make this tutorial incorrect. I hope to grab it and make appropriate updates later tonight or tomorrow.
Last edited by bp (2006-12-10 23:18:25)
Offline
bp wrote:
I'm glad you liked it. Great series you have too! I look forward to more.
Also a quick note on this tutorial. I received an email from Olle Jonsson, including line by line edits (thanks Olle!), letting me know that the latest version of BackgrounDRb, 0.2.1, includes some changes that make this tutorial incorrect. I hope to grab it and make appropriate updates later tonight or tomorrow.
One thing I'd recommend is also to look at daemon generator. It's a MUCH simpler system than BackgroundDB, but it's also EXTREMLY simple and adds very little code. I use it for sending alarms in Famundo to IM. It sleeps for some time, check the DB for alarms, send the ones triggered, and go back to sleep. It was stupid easy with daemon_generator.
Offline
LoadError: no such file to load -- XMPP4R
I have run the setup.rb. But it seems that I can not load the file:XMPP4R.
Would you kindly please help me? Thanks for your tutorial!
Offline
I'm receiving an error like this:
Last edited by fnando (2007-06-24 01:01:54)
Offline
If I wanted to make a simple Jabber client using Rails. Let's say I just want to be able to send and receive messages using xmpp4r-simple...do I really need to go through the trouble of running a seperate process with backgroundrb?
Here is the awesome xmpp4r-simple library: http://xmpp4r-simple.rubyforge.org/
This seems like there should be an easier way to handle this than having to deal with backgroundrb. Why can't I do something like simply create the Jabber connection:
Last edited by xgamerx (2007-07-24 08:09:56)
Offline