class Vines::Stream::Http::BindRestart
Public Class Methods
new(stream, success=Bind)
click to toggle source
Calls superclass method
# File lib/vines/stream/http/bind_restart.rb, line 7 def initialize(stream, success=Bind) super end
Public Instance Methods
node(node)
click to toggle source
# File lib/vines/stream/http/bind_restart.rb, line 11 def node(node) raise StreamErrors::NotAuthorized unless restart?(node) doc = Document.new body = doc.create_element('body') do |el| el.add_namespace(nil, NAMESPACES[:http_bind]) el.add_namespace('stream', NAMESPACES[:stream]) el << doc.create_element('stream:features') do |features| features << doc.create_element('bind', 'xmlns' => NAMESPACES[:bind]) end end stream.reply(body) advance end
Private Instance Methods
restart?(node)
click to toggle source
# File lib/vines/stream/http/bind_restart.rb, line 28 def restart?(node) session = stream.valid_session?(node['sid']) restart = node.attribute_with_ns('restart', NAMESPACES[:bosh]).value rescue nil domain = node['to'] == stream.domain session && body?(node) && domain && restart == 'true' && node['rid'] end