Created
November 1, 2010 18:01
-
-
Save smith/658609 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "eventmachine" | |
module EchoServer | |
def post_init | |
puts "-- someone connected to the EventMachine echo server!" | |
end | |
def receive_data data | |
send_data ">>>you sent: " + data | |
end | |
end | |
EventMachine::run do | |
EventMachine::start_server "0.0.0.0", 8081, EchoServer | |
puts "Running EventMachine echo server on 8081" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment