Jabber/XMPP gem for Rails 3.2 [closed]

独自空忆成欢 提交于 2019-12-07 12:24:42

问题


Im looking for a solid and working XMPP gem for rails 3.2

There are hundreds of them in the net, but most of them outdated or alpha.

Can you recommend me one for rails 3.2?


回答1:


The gem xmpp4r works fine. (https://github.com/ln/xmpp4r)

Here is an example:

require 'xmpp4r'

sender_jid = Jabber::JID.new('a@b.com')
client = Jabber::Client.new(sender_jid)
client.connect('talk.google.com')
client.auth('password')

client.send(Jabber::Presence.new.set_show(:chat)).set_status('my status')

receiver_jid = Jabber::JID.new("dest@domain.com")
message = Jabber::Message::new(receiver_jid, "Testing").set_type(:normal).set_id('1')
client.send(message)


来源:https://stackoverflow.com/questions/12018444/jabber-xmpp-gem-for-rails-3-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!