I currently use xmpp4r (via xmpp4r-simple) to read IM's in a
Selenium test suite. The IM's are generated by browser activity (things I do in my Selenium code). So, my test code roughly looks like:
initialize browser
initialize xmpp4r-simple object
...
do some browser stuff
...
do something in the browser that I expect to generate an IM:
read received messages from the im object -> verify they are as expected.
[note: a sequential set of steps with a specific point where I want to read the IM]
I'm in the process of upgrading ruby (from Ruby 1.9.1) and I find xmpp4r is broken for me in Ruby 1.9.2 and Ruby 1.9.3 (on Windows). Since xmpp4r appears to be a dead project, I figure I'll upgrade to something still alive. blather seems to be what I should be using.
I have gotten blather working via the example
here and I'm able to connect to it and bounce messages back and forth. I'm finding the Event Machine stuff a little confusing. It works in my example code, but I don't quite grok it.
Anyway, what I'd really like to do is be able to initialize a blather client object, have it sitting there in my code, and be able to query it at a specific point in my code to see what IM's it has received. Is that something I can do? I've been trying to do that but with the EventMachine code, but I can't seem to get control of the sequence of events.
I realize a major feature of blather is its ability to do all this stuff asynchronously, and I can see that is really useful in many (probably most) scenarios. My problem is I'm trying to do something in a very specific sequence, and I can't figure out how to control the sequence of events. I have a feeling I'm missing something obvious, but I'm not sure what that is.
Sorry for this very wordy post. I think I mostly just need to be pointed in the right direction.
Thanks!