Skip to content

Instantly share code, notes, and snippets.

@ericsaboia
Created September 21, 2011 12:24
Show Gist options
  • Save ericsaboia/1231902 to your computer and use it in GitHub Desktop.
Save ericsaboia/1231902 to your computer and use it in GitHub Desktop.
Eventmachine Server
# encoding: utf-8
require 'rubygems'
require 'eventmachine'
require 'java'
require 'lib/report'
require 'lib/filler'
module ReportServer
def receive_data data
stream = Filler.process(data)
send_data stream
close_connection_after_writing
end
end
EventMachine::run {
EventMachine::start_server "127.0.0.1", 8081, ReportServer
puts 'Reports Server running at port 8081'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment