aboutsummaryrefslogtreecommitdiffstats
path: root/app/helpers/inboxes_helper.rb
diff options
context:
space:
mode:
authorKir2011-11-16 14:41:29 +0400
committerKir2011-11-16 14:41:29 +0400
commit661590c630f022fc678c4d5664b497db13de6eec (patch)
tree0c434d3e4560b6cb13c7184c31472dd824b5bbe5 /app/helpers/inboxes_helper.rb
parent61bd4dd67fdaee93af6994d539b86d46cd1c45f1 (diff)
downloadinboxes-661590c630f022fc678c4d5664b497db13de6eec.tar.bz2
Faye integration, resources under modulev0.0.1
Diffstat (limited to 'app/helpers/inboxes_helper.rb')
-rw-r--r--app/helpers/inboxes_helper.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/helpers/inboxes_helper.rb b/app/helpers/inboxes_helper.rb
new file mode 100644
index 0000000..87bb763
--- /dev/null
+++ b/app/helpers/inboxes_helper.rb
@@ -0,0 +1,9 @@
+require 'net/http'
+module InboxesHelper
+ def inboxes_faye_broadcast(channel, &block)
+ message = {:channel => channel, :data => capture(&block), :ext => {:auth_token => defined?(FAYE_TOKEN) ? FAYE_TOKEN : ""}}
+ uri = URI.parse("http://#{Inboxes::config.faye_host}:#{Inboxes::config.faye_port}/faye")
+ # Rails.logger.info "Faye URL: #{uri}"
+ res = Net::HTTP.post_form(uri, :message => message.to_json)
+ end
+end \ No newline at end of file