0

I'm trying to test sending a message to one jid account by using xmpp4r:

require 'xmpp4r'
include Jabber

jid = JID::new('alice@wonderland.lit')
password = 'secr3t'

cl = Client::new(jid)
cl.connect('166.78.7.179')
cl.auth(password)
cl.send(Presence.new)

to = 'arthur@wonderland.lit'
subject = 'XMPP4R test'
body = 'Hi, this is a XMPP4R test'
m = Message::new( to, body ).set_type(:chat).set_id('1').set_subject(subject)
cl.send m

But I always get the following exception:

/home/subout/.rvm/gems/ruby-1.9.3-p374@subout/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:118:in `rescue in auth': closed stream (Jabber::ClientAuthenticationFailure)
   from /home/subout/.rvm/gems/ruby-1.9.3-p374@subout/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:108:in `auth'
   from send_message2.rb:9:in `<main>'
Samnang
  • 5,536
  • 6
  • 35
  • 47

1 Answers1

1
  • First of all, would you please add Jabber::debug = true setting before cl.connect and post output here?
  • Secondly, it looks like there is a problem with XMPP server (are you sure it’s running at '166.78.7.179'?)
  • And, the last but not the least, why do you decide to use “obsolete” xmpp4r rather than it’s modern successor Blather?
Aleksei Matiushkin
  • 119,336
  • 10
  • 100
  • 160
  • After I switch from Vines to ejabberd, it works fine. I would like to try Blather as well, but how can I send a simple message without blocking with EventMachine? – Samnang Apr 04 '13 at 08:50
  • Vines has some issues, yeah. Vines Agent code is full of examples of sending non-blocking stanzas w/EM. – Aleksei Matiushkin Apr 04 '13 at 09:59
  • @mudasobwa Looking at vines agent code now but if you could point out such an example I'd appreciate it. – gduq Apr 09 '13 at 13:06
  • @gduq An example of what? The simple 6-line echo-bot example is provided at official [Blather page](https://github.com/adhearsion/blather) (scroll to “Examples”.) – Aleksei Matiushkin Apr 10 '13 at 03:55
  • @mudasobwa I'm trying to get Blather going on Windows but there is a 5 years old issue with EM which prevents it from establishing a encrypted connection. xmpp4r has almost no documentation nor examples. The ones I found are wrong or outdated and don't run anymore on current versions. Any advice what else to try? – Steffen Roller Mar 19 '15 at 00:15
  • @SteffenRoller Unfortunately, no. Sorry for that. – Aleksei Matiushkin Mar 20 '15 at 04:46