Sha256: 0a396d8e6a6da32f169df1edee99dca0a297bdfc74cb47d1954115d6386c4e75

Contents?: true

Size: 631 Bytes

Versions: 1

Compression:

Stored size: 631 Bytes

Contents

class SatParser < EventMachine::Connection
    
  attr_accessor :db  
    
  def post_init
    puts self.inspect
    @db = EventMachine::MySQL.new(:host => "localhost", :username => "root", :database => "keyhole_development")
    $channel << "{event:'connect', 'type':'tracker'}"
  end
  
  def receive_data(data)
    puts "Data received..."
    puts data.inspect
    q = @db.query("insert into locations(latitude, longitude) value('ninja', 'neger');")
    q.callback{|res| puts res.inspect}
    q.errback{|res| puts "E:"+res.inspect}
    $channel << data
  end
  
  def unbind
    $channel << "GSAT closed connection"
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
keyhole-0.1.5 lib/sat_parser.rb