Jabber/XMPP gem for Rails 3.2 [closed]

2019-05-06 17:15发布

问题:

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)