Skip to content

Instantly share code, notes, and snippets.

@bmizerany
Created October 31, 2008 21:19
Show Gist options
  • Save bmizerany/21422 to your computer and use it in GitHub Desktop.
Save bmizerany/21422 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'eventmachine'
module TapsClient
def post_init
send_data("hey!")
end
def receive_data(data)
p [Time.now, data]
STDOUT.flush
end
end
EventMachine.run do
EM.connect 'localhost', 5678, TapsClient
end
require 'rubygems'
require 'eventmachine'
module TapsServer
def recieve_data(data)
send_data(data)
end
end
EM.run do
EM.start_server('localhost', 5678, TapsServer)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment