Class: Pubnub::OriginManager

Inherits:
Object
  • Object
show all
Defined in:
lib/pubnub/origin_manager.rb

Overview

OriginManager changes origin in client to online one and keeps monitoring available origins

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ OriginManager

Returns a new instance of OriginManager.



8
9
10
# File 'lib/pubnub/origin_manager.rb', line 8

def initialize(app)
  @app = app
end

Instance Attribute Details

#failbackObject (readonly)

Returns the value of attribute failback.



6
7
8
# File 'lib/pubnub/origin_manager.rb', line 6

def failback
  @failback
end

#last_pingObject (readonly)

Returns the value of attribute last_ping.



6
7
8
# File 'lib/pubnub/origin_manager.rb', line 6

def last_ping
  @last_ping
end

Instance Method Details

#current_originObject



20
21
22
# File 'lib/pubnub/origin_manager.rb', line 20

def current_origin
  @app.current_origin
end

#offline_originsObject



28
29
30
# File 'lib/pubnub/origin_manager.rb', line 28

def offline_origins
  @app.offline_origins
end

#online_originsObject



24
25
26
# File 'lib/pubnub/origin_manager.rb', line 24

def online_origins
  @app.online_origins
end

#startObject



12
13
14
15
16
17
18
# File 'lib/pubnub/origin_manager.rb', line 12

def start
  origin_to_test = current_origin
  return false unless test_origin(origin_to_test)

  bring_down(origin_to_test)
  @app.reset_subscription
end