Class: Vines::Cluster::StreamProxy
- Inherits:
-
Object
- Object
- Vines::Cluster::StreamProxy
- Defined in:
- lib/vines/cluster.rb
Overview
StreamProxy behaves like an EM::Connection so that stanzas may be sent to remote nodes just as they are to locally connected streams. The rest of the system doesn’t know or care that these “streams” send their traffic over redis pubsub channels.
Instance Attribute Summary collapse
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#initialize(cluster, session) ⇒ StreamProxy
constructor
A new instance of StreamProxy.
- #interested? ⇒ Boolean
- #last_broadcast_presence ⇒ Object
- #write(stanza) ⇒ Object
Constructor Details
#initialize(cluster, session) ⇒ StreamProxy
Returns a new instance of StreamProxy.
206 207 208 209 210 211 212 213 214 |
# File 'lib/vines/cluster.rb', line 206 def initialize(cluster, session) @cluster, @user = cluster, UserProxy.new(cluster, session) @node, @available, @interested, @presence = session.values_at('node', 'available', 'interested', 'presence') unless @presence.nil? || @presence.empty? @presence = Nokogiri::XML(@presence).root rescue nil end end |
Instance Attribute Details
#user ⇒ Object (readonly)
Returns the value of attribute user.
204 205 206 |
# File 'lib/vines/cluster.rb', line 204 def user @user end |
Instance Method Details
#available? ⇒ Boolean
216 217 218 |
# File 'lib/vines/cluster.rb', line 216 def available? @available end |
#interested? ⇒ Boolean
220 221 222 |
# File 'lib/vines/cluster.rb', line 220 def interested? @interested end |
#last_broadcast_presence ⇒ Object
224 225 226 |
# File 'lib/vines/cluster.rb', line 224 def last_broadcast_presence @presence end |
#write(stanza) ⇒ Object
228 229 230 |
# File 'lib/vines/cluster.rb', line 228 def write(stanza) @cluster.route(stanza, @node) end |