Skip to content

Instantly share code, notes, and snippets.

@coderhs
Created September 23, 2013 08:53
Show Gist options
  • Save coderhs/6668070 to your computer and use it in GitHub Desktop.
Save coderhs/6668070 to your computer and use it in GitHub Desktop.
Code to get sid and rid from BOSH service of a jabber server. (Server being used here is prosody )
require 'xmpp4r/httpbinding/client'
@client = Jabber::HTTPBinding::Client.new("[email protected]")
@client.connect("http://example.com/http-bind")
@client.auth("password")
sid = @client.instance_variable_get("@http_sid")
rid = @client.instance_variable_get("@http_rid")
puts sid
puts rid
/usr/local/lib/ruby/gems/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:118:in `rescue in auth': undefined method `kill' for nil:NilClass (Jabber::ClientAuthenticationFailure)
from /usr/local/lib/ruby/gems/1.9.1/gems/xmpp4r-0.5/lib/xmpp4r/client.rb:108:in `auth'
from /home/hsps/sandbox/post.rb:5:in `<main>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment