Forum: Ruby xmpp4r and openfire 3.7

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E9ae187b79a17b6b1612b1a41d35d594?d=identicon&s=25 Nemus Muu (nemus)
on 2011-08-29 23:20
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("rbot@openfire.server.com"))
client.connect
client.auth("bestpasswordever")
client.send(Presence.new.set_type(:available))

http://pastebin.com/CevFR2Qj
0adf360e3807fd610c681e18232c44a2?d=identicon&s=25 Mike S. (mike_s97)
on 2012-01-07 23:01
Can you define 'not work'

Does it 'not connect', 'not authorise'.....
A9c549f85b6f3256943b64f70a8b14aa?d=identicon&s=25 Aldo Aldobm (aldo)
on 2014-09-13 21:20
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
A9c549f85b6f3256943b64f70a8b14aa?d=identicon&s=25 Aldo Aldobm (aldo)
on 2014-09-13 21:20
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
A9c549f85b6f3256943b64f70a8b14aa?d=identicon&s=25 Aldo Aldobm (aldo)
on 2014-09-13 21:22
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
This topic is locked and can not be replied to.