Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/private_pub/view_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,14 @@ def subscribe_to(channel)
raw("PrivatePub.sign(#{subscription.to_json});")
end
end

# Subscribe the client to the given channel W/o generate
# <script></script> tag. This generates some JavaScript calling
# PrivatePub.sign with the subscription options.
def tiny_subscribe_to(channel)
subscription = PrivatePub.subscription(:channel => channel)
raw("PrivatePub.sign(#{subscription.to_json});")
end

end
end