Sha256: 0ae746e8eb46c4c840b7008fee3dd1fb668d3fb438094d799e9cd9f9cd006dc5
Contents?: true
Size: 922 Bytes
Versions: 37
Compression:
Stored size: 922 Bytes
Contents
module Blather class Stream # @private class Session < Features SESSION_NS = 'urn:ietf:params:xml:ns:xmpp-session'.freeze register SESSION_NS def initialize(stream, succeed, fail) super @to = @stream.jid.domain end 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 def check_response if @node[:type] == 'result' succeed! else fail!(StanzaError.import(@node)) end end ## # Send a start session command 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 end end end
Version data entries
37 entries across 37 versions & 2 rubygems