Skip to content

Instantly share code, notes, and snippets.

@macournoyer
Created January 5, 2010 05:45
Show Gist options
  • Select an option

  • Save macournoyer/269171 to your computer and use it in GitHub Desktop.

Select an option

Save macournoyer/269171 to your computer and use it in GitHub Desktop.
require "talker"
module Connection
attr_accessor :client
def data_received(data)
client.send_message data
end
end
Talker::Client.connect(:room => room, :token => token) do |client|
client.on_connected do
@connection = EM.connect "0.0.0.0", 8000, Connection
@connection.client = client
end
client.on_message do |user, message|
@connection.send_data message
end
client.on_error do |error|
puts error
end
client.on_close do
EM.stop
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment