Samnang
Samnang

Reputation: 5616

Can't send a message from xmpp4r?

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

require 'xmpp4r'
include Jabber

jid = JID::new('[email protected]')
password = 'secr3t'

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

to = '[email protected]'
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>'

Upvotes: 0

Views: 1547

Answers (1)

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 121000

  • 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?

Upvotes: 1

Related Questions