Class: Xap::XapHeartbeat

Inherits:
XapMessage show all
Defined in:
lib/xap/xap_msg.rb

Overview

An xAP heartbeat message.

Instance Attribute Summary collapse

Attributes inherited from XapMessage

#headername, #hop, #msgclass, #src_addr, #target_addr, #uid, #version

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from XapMessage

register_class, #to_s, #uid_endpoint

Constructor Details

#initialize(src_addr, src_uid, interval = 60) ⇒ XapHeartbeat

Returns a new instance of XapHeartbeat.



182
183
184
185
186
187
188
189
190
191
192
# File 'lib/xap/xap_msg.rb', line 182

def initialize src_addr, src_uid, interval = 60
	@headername = 'xap-hbeat'
	if src_addr.is_a?(Hash)
		parse_header src_addr[@headername]
		interval = src_addr[@headername]['interval'] || interval
	else
		super 'xap-hbeat.alive', src_addr, src_uid
	end
	add_header 'interval', interval
	@interval = interval
end

Instance Attribute Details

#intervalObject

Returns the value of attribute interval.



176
177
178
# File 'lib/xap/xap_msg.rb', line 176

def interval
  @interval
end

Class Method Details

.parse(hash) ⇒ Object



178
179
180
# File 'lib/xap/xap_msg.rb', line 178

def self.parse hash
	self.new hash, nil
end