Skip to content

Instantly share code, notes, and snippets.

@evanphx
Created May 13, 2011 16:41
Show Gist options
  • Select an option

  • Save evanphx/970856 to your computer and use it in GitHub Desktop.

Select an option

Save evanphx/970856 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'eventmachine'
module Echo
def initialize
puts caller(0)
end
def receive_data(data)
send_data data
end
def unbind
puts "done"
end
end
EventMachine.run do
EventMachine.add_periodic_timer(5) do
puts "GCing"
GC.run(true)
end
EventMachine.add_periodic_timer(1) do
print "EventMachine::Connection objects: "
puts ObjectSpace.each_object(EventMachine::Connection) { }
end
EventMachine.start_server '127.0.0.1', 4015, Echo
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment