Created
January 16, 2012 12:14
-
-
Save wjessop/1620597 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$:.unshift File.join(File.dirname(__FILE__), 'lib') | |
require 'em-campfire' | |
EM.run { | |
adaptor = EM::Campfire.new(:subdomain => "subdomain", :api_key => "foo") | |
connection.join ["Robot Army", "Monitoring", "Testing"] | |
connection.on_message do |msg| | |
# A hash | |
puts msg.inspect | |
end | |
# Give lib a chance to connect | |
EM::Timer.new(10) do | |
# Say something on a specific channel | |
connection.say "This goes only to one channel", "Robot Army" | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment