Sha256: baa22d305e9d871ce0e777abbdc2451565f3c69dbde3ed55e1cd058c8031579b
Contents?: true
Size: 825 Bytes
Versions: 4
Compression:
Stored size: 825 Bytes
Contents
module Thunderer module ViewHelpers # Publish the given data or block to the client by sending # a Net::HTTP POST request to the Faye server. If a block # or string is passed in, it is evaluated as JavaScript # on the client. Otherwise it will be converted to JSON # for use in a JavaScript callback. def publish_to(channel, data = nil, &block) Thunderer.publish_to(channel, data || capture(&block)) end # Subscribe the client to the given channel. This generates # some JavaScript calling PrivatePub.sign with the subscription # options. def subscribe_to(channel) subscription = Thunderer.subscription(:channel => channel) content_tag 'script', :type => 'text/javascript' do raw("Thunderer.sign(#{subscription.to_json});") end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
thunderer-1.1.3 | lib/thunderer/view_helpers.rb |
thunderer-1.1.1 | lib/thunderer/view_helpers.rb |
thunderer-1.1.0 | lib/thunderer/view_helpers.rb |
thunderer-1.0.0 | lib/thunderer/view_helpers.rb |