0
我试图测试使用xmpp4r将消息发送到一个JID账号:不能发送消息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
但我总是得到以下异常:
/home/subout/.rvm/gems/[email protected]/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:118:in `rescue in auth': closed stream (Jabber::ClientAuthenticationFailure)
from /home/subout/.rvm/gems/[email protected]/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:108:in `auth'
from send_message2.rb:9:in `<main>'
当我从葡萄藤切换到ejabberd后,它工作正常。我也想尝试Blather,但是如何发送简单的消息而不用EventMachine阻塞? – Samnang
葡萄藤有一些问题,是的。 Vines Agent代码充满了发送带EM的非阻塞节的示例。 – mudasobwa
@mudasobwa现在看看藤代理代码,但如果你能指出这样一个例子,我会很感激。 – gduq