Method: Archipelago::Client::Base#setup_client

Defined in:
lib/archipelago/client.rb

#setup_client(options = {}) ⇒ Object

Initialize a Client using Archipelago::Disco::MC or :jockey if given, or a new Archipelago::Disco::Jockey if none, that looks for new services :initial_service_update_interval or INITIAL_SERVICE_UPDATE_INTERVAL, when it starts and never slower than every :maximum_service_update_interval or MAXIMUM_SERVICE_UPDATE_INTERVAL.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/archipelago/client.rb', line 53

def setup_client(options = {})
  setup_jockey(options)

  @initial_service_update_interval = options[:initial_service_update_interval] || INITIAL_SERVICE_UPDATE_INTERVAL
  @maximum_service_update_interval = options[:maximum_service_update_interval] || MAXIMUM_SERVICE_UPDATE_INTERVAL
  @service_descriptions = options[:service_descriptions]
  @initial_lookup_timeout = options[:initial_lookup_timeout] || INITIAL_LOOKUP_TIMEOUT
  @debug_callable = options[:debug_callable]
  @services = {}
  @service_descriptions.each do |name, description|
    @services[name] = Archipelago::Disco::ServiceLocker.new
    @services[name].convert_to_tree!
  end

  start_service_updater
  start_subscriptions
end