Class: Pergo::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/pergo/server.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



10
11
12
13
14
15
16
17
18
19
# File 'lib/pergo/server.rb', line 10

def initialize(options = {})
  @host = options.fetch(:host, "0.0.0.0")
  @port = options.fetch(:port, 9732)

  Propono.config.access_key = config.access_key
  Propono.config.secret_key = config.secret_key
  Propono.config.queue_region = config.queue_region
  Propono.config.udp_host = config.host
  Propono.config.udp_port = config.port
end

Class Method Details

.run(*args) ⇒ Object



6
7
8
# File 'lib/pergo/server.rb', line 6

def self.run(*args)
  new(*args).run
end

Instance Method Details

#runObject



21
22
23
24
25
# File 'lib/pergo/server.rb', line 21

def run
  Propono.listen_to_udp do |text|
    Propono.publish(config.topic, text)
  end
end