Xmpp4r and openfire 3.7


#1

I cannot get this piece of code to work with my openfire 3.7.0 xmpp
server.

#!/usr/bin/env ruby
$:.unshift “xmpp4r/lib”
require ‘xmpp4r’
require ‘xmpp4r/version’
include Jabber

Jabber::debug = true
puts Jabber::XMPP4R_VERSION

client = Client.new(JID::new(“removed_email_address@domain.invalid”))
client.connect
client.auth(“bestpasswordever”)
client.send(Presence.new.set_type(:available))

http://pastebin.com/CevFR2Qj


#2

Can you define ‘not work’

Does it ‘not connect’, ‘not authorise’…


#3

require ‘xmpp4r’
require ‘xmpp4r/muc’
require ‘xmpp4r/roster’
require ‘xmpp4r/client’

require ‘rubygems’

include Jabber

class PagesController < ApplicationController
def arduino

puts ‘inicianto…’
jid = JID::new(‘test@openfiredac’)
password = ‘test’
#Jabber::debug = true

cl = Client::new(jid)
puts ‘tratando …’
cl.use_ssl = false
cl.allow_tls = false
cl.ssl_capath = false
cl.ssl_verifycb = false

cl.connect(‘192.168.88.232’,5222)
puts ‘passss…’
sleep(3)
cl.auth(‘test’)
#cl.auth_anonymous_sasl
#cl.auth_sasl(sasl, ‘test’)
#cl.auth_anonymous

the code needs disable security config in openfire console
“server-config security config TLS method not available”

the sleep after connect is more important, disable and code not works


#4

continue… code

puts ‘dentrol…’
cl.send(Presence.new)
puts ‘ok …’

to = ‘aldo@openfiredac’
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
sleep (1)
cl.close

puts ‘close’

end


#5

debug :

Started GET “/pages/arduino” for 192.168.88.254 at 2014-09-13 14:21:47
-0500
Processing by PagesController#arduino as HTML
inicianto…
tratando …
passss…
dentrol…
ok …
close
Rendered pages/arduino.html.erb within layouts/application (1.3ms)
Completed 200 OK in 4136ms (Views: 81.3ms | ActiveRecord: 0.0ms)

Started GET “/assets/arduino.css?body=1” for 192.168.88.254 at
2014-09-13 14:21:52 -0500

Started GET “/assets/jquery.js?body=1” for 192.168.88.254 at 2014-09-13
14:21:52 -0500

Started GET “/assets/application.css?body=1” for 192.168.88.254 at
2014-09-13 14:21:52 -0500

Started GET “/assets/pages.css?body=1” for 192.168.88.254 at 2014-09-13
14:21:52 -0500

Started GET “/assets/jquery_ujs.js?body=1” for 192.168.88.254 at
2014-09-13 14:21:52 -0500

Started GET “/assets/turbolinks.js?body=1” for 192.168.88.254 at
2014-09-13 14:21:52 -0500

Started GET “/assets/pages.js?body=1” for 192.168.88.254 at 2014-09-13
14:21:52 -0500

Started GET “/assets/application.js?body=1” for 192.168.88.254 at
2014-09-13 14:21:52 -0500

Started GET “/assets/arduino.js?body=1” for 192.168.88.254 at 2014-09-13
14:21:52 -0500