class Blather::Stream::Session
@private
Constants
- SESSION_NS
Public Class Methods
new(stream, succeed, fail)
click to toggle source
Calls superclass method
Blather::Stream::Features::new
# File lib/blather/stream/features/session.rb, line 9 def initialize(stream, succeed, fail) super @to = @stream.jid.domain end
Public Instance Methods
receive_data(stanza)
click to toggle source
# File lib/blather/stream/features/session.rb, line 14 def receive_data(stanza) @node = stanza case stanza.element_name when 'session' then session when 'iq' then check_response else fail!(UnknownResponse.new(stanza)) end end
Private Instance Methods
check_response()
click to toggle source
# File lib/blather/stream/features/session.rb, line 24 def check_response if @node[:type] == 'result' succeed! else fail!(StanzaError.import(@node)) end end
session()
click to toggle source
Send a start session command
# File lib/blather/stream/features/session.rb, line 34 def session response = Stanza::Iq.new :set response.to = @to response << (sess = XMPPNode.new('session', response.document)) sess.namespace = SESSION_NS @stream.send response end