Skip to content

Instantly share code, notes, and snippets.

@titanous
Created March 18, 2011 14:54
Show Gist options
  • Save titanous/876195 to your computer and use it in GitHub Desktop.
Save titanous/876195 to your computer and use it in GitHub Desktop.
require 'json'
require 'net/http'
require 'uri'
module Bayeux
ENDPOINT = URI.parse('http://localhost:3000/faye')
def self.publish(channel, data)
message = {'channel' => channel, 'data' => data.to_hash}
Net::HTTP.post_form(ENDPOINT, :message => JSON.unparse(message))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment