Skip to content

Instantly share code, notes, and snippets.

@trotter
Created April 2, 2011 17:57
Show Gist options
  • Select an option

  • Save trotter/899702 to your computer and use it in GitHub Desktop.

Select an option

Save trotter/899702 to your computer and use it in GitHub Desktop.
The Chloe example
var chloe = new Chloe({host: "<%= server_name %>", port: 8901});
chloe.connect(function () {
console.log('Holy crap, connected!');
chloe.send('Ohai Chloe!');
chloe.subscribe('pumpkin', function (message) {
console.log('Someone was eating pumpkins: ' + message);
});
});
post '/updates' do
data = request.body.read
Net::HTTP.post_form(URI.parse("http://#{server_name}:8901/send"),
{"data" => "Handled by Sinatra: #{data}"})
puts "I got some data: #{data}"
"success"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment