Class: Whosup::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/whosup/client.rb

Instance Method Summary collapse

Instance Method Details

#start(server, port) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/whosup/client.rb', line 8

def start(server, port)

  meter = Meter.new
  output = CoreAudio.default_output_device.output_buffer(1024)

  output.start
  TCPSocket.open(server, port) do |socket|
    while message = socket.gets
      data = MultiJson.load(message)
      output << data
      meter << data
    end
  end
end