Sha256: 601edb723ef0cd6696c4ca3380905b8327a1fae22bd65ae5b206856b24c39588
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require 'rubygems' require 'eventmachine' require File.dirname(__FILE__) + '/sat_parser' require File.dirname(__FILE__) + '/query_server' require 'em-websocket' require 'sinatra/base' require 'thin' require 'em-mysqlplus' require 'json' EventMachine.run{ # This can implement the AJAX-based query-server, without any need # of multiple servers. Or, it can just be an http-based reporting tool. class Querier < Sinatra::Base get "/" do return "This is Keyhole, with #{$clients.length} trackers and #{$webclients.length} webclients connected." end end $channel = EM::Channel.new $clients = {} $webclients = {} EventMachine::start_server "0.0.0.0", 5000, SatParser EventMachine::start_server "0.0.0.0", 5500, QueryServer # TODO - Make sure this reads config from a config-file instead of this weird thing! EventMachine::WebSocket.start(:host => "0.0.0.0", :port => 8080, :debug => true) do |ws| ws.onopen{ sid = $channel.subscribe { |msg| ws.send msg } $webclients[sid] = true ws.onmessage{|msg| $channel.push "Ninja!" } ws.onclose{ $channel.unsubscribe(sid) $webclients.delete(sid) } } end Querier.run!({:port => 3000}) }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
keyhole-0.1.7 | lib/keyhole.rb |
keyhole-0.1.6 | lib/keyhole.rb |