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