Class: Bosh4r::Session
Instance Attribute Summary collapse
-
#jid ⇒ Object
readonly
Returns the value of attribute jid.
-
#rid ⇒ Object
readonly
Returns the value of attribute rid.
-
#sid ⇒ Object
readonly
Returns the value of attribute sid.
Instance Method Summary collapse
- #connected? ⇒ Boolean
-
#initialize(jabber_id, password, options = {}) ⇒ Session
constructor
A new instance of Session.
Methods included from Utils
#build_xml, #send_bosh_request
Constructor Details
#initialize(jabber_id, password, options = {}) ⇒ Session
Returns a new instance of Session.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/bosh4r/session.rb', line 25 def initialize(jabber_id, password, = {}) split_jabber_id = jabber_id.split('/') = split_jabber_id.first resource_name = split_jabber_id.last if split_jabber_id.size > 1 @jabber_id = @password = password @host = @jabber_id.split('@').last @bosh_url = [:bosh_url] || 'http://localhost:5280/http-bind' @timeout = [:timeout] || 5 # Network timeout @wait = [:wait] || 5 # Longest time the connection manager is allowed to wait before responding @hold = [:hold] || 1 # Number of connections that the connection manager can hold @version = [:version] || '1.0' # BOSH protocol version @rid = rand(1000) @resource_name = resource_name.nil? ? "bosh_#{Time.now.to_i.to_s(36)}" : resource_name connect end |
Instance Attribute Details
#jid ⇒ Object (readonly)
Returns the value of attribute jid.
23 24 25 |
# File 'lib/bosh4r/session.rb', line 23 def jid @jid end |
#rid ⇒ Object (readonly)
Returns the value of attribute rid.
23 24 25 |
# File 'lib/bosh4r/session.rb', line 23 def rid @rid end |
#sid ⇒ Object (readonly)
Returns the value of attribute sid.
23 24 25 |
# File 'lib/bosh4r/session.rb', line 23 def sid @sid end |
Instance Method Details
#connected? ⇒ Boolean
44 45 46 |
# File 'lib/bosh4r/session.rb', line 44 def connected? @connected end |