aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/lib/action_cable/server/broadcasting.rb
diff options
context:
space:
mode:
authorNick Quaranto <nick@quaran.to>2016-02-02 11:16:41 -0500
committerNick Quaranto <nick@quaran.to>2016-02-02 15:00:05 -0500
commit830543738507f49444956b3b6ae897f4638b2523 (patch)
tree5f6eaf8b78d1fcdc0d6b29a949bbfc1d4445b2c2 /actioncable/lib/action_cable/server/broadcasting.rb
parent473f63734a55d2a91083a619ce1395dfe32aec8d (diff)
downloadrails-830543738507f49444956b3b6ae897f4638b2523.tar.gz
rails-830543738507f49444956b3b6ae897f4638b2523.tar.bz2
rails-830543738507f49444956b3b6ae897f4638b2523.zip
[ci skip] Several ActionCable documentation updates:
* Properly indent code sample in ActionCable::Channel::Streams * Add a doc comment for #stop_all_streams * Reformat + add <tt> blocks around code references in ActionCable::Base docs * Clarify and a little better grammar on ActionCable::RemoteConnections * Correct indentation and clean up ActionCable::Server::Broadcasting code sample
Diffstat (limited to 'actioncable/lib/action_cable/server/broadcasting.rb')
-rw-r--r--actioncable/lib/action_cable/server/broadcasting.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/actioncable/lib/action_cable/server/broadcasting.rb b/actioncable/lib/action_cable/server/broadcasting.rb
index 4a26ed9269..7e8aef45f4 100644
--- a/actioncable/lib/action_cable/server/broadcasting.rb
+++ b/actioncable/lib/action_cable/server/broadcasting.rb
@@ -4,19 +4,19 @@ module ActionCable
# broadcastings are streamed directly to the clients subscribed to the named broadcasting. Let's explain with a full-stack example:
#
# class WebNotificationsChannel < ApplicationCable::Channel
- # def subscribed
- # stream_from "web_notifications_#{current_user.id}"
- # end
- # end
+ # def subscribed
+ # stream_from "web_notifications_#{current_user.id}"
+ # end
+ # end
#
- # # Somewhere in your app this is called, perhaps from a NewCommentJob
- # ActionCable.server.broadcast \
- # "web_notifications_1", { title: 'New things!', body: 'All shit fit for print' }
+ # # Somewhere in your app this is called, perhaps from a NewCommentJob
+ # ActionCable.server.broadcast \
+ # "web_notifications_1", { title: "New things!", body: "All that's fit for print" }
#
- # # Client-side coffescript, which assumes you've already requested the right to send web notifications
- # App.cable.subscriptions.create "WebNotificationsChannel",
- # received: (data) ->
- # new Notification data['title'], body: data['body']
+ # # Client-side CoffeeScript, which assumes you've already requested the right to send web notifications
+ # App.cable.subscriptions.create "WebNotificationsChannel",
+ # received: (data) ->
+ # new Notification data['title'], body: data['body']
module Broadcasting
# Broadcast a hash directly to a named <tt>broadcasting</tt>. It'll automatically be JSON encoded.
def broadcast(broadcasting, message)