aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/action_cable_overview.md
diff options
context:
space:
mode:
Diffstat (limited to 'guides/source/action_cable_overview.md')
-rw-r--r--guides/source/action_cable_overview.md12
1 files changed, 7 insertions, 5 deletions
diff --git a/guides/source/action_cable_overview.md b/guides/source/action_cable_overview.md
index 2308befd12..118b0b52b2 100644
--- a/guides/source/action_cable_overview.md
+++ b/guides/source/action_cable_overview.md
@@ -9,7 +9,9 @@ After reading this guide, you will know:
* What Action Cable is and its integration on backend and frontend
* How to setup Action Cable
* How to setup channels
-* Deployment and Architecture setup for running Action Cable
+* Deployment and Architecture setup for running Action Cable
+
+--------------------------------------------------------------------------------
Introduction
------------
@@ -240,10 +242,10 @@ WebNotificationsChannel.broadcast_to(
The `WebNotificationsChannel.broadcast_to` call places a message in the current
subscription adapter (Redis by default)'s pubsub queue under a separate
broadcasting name for each user. For a user with an ID of 1, the broadcasting
-name would be `web_notifications_1`.
+name would be `web_notifications:1`.
The channel has been instructed to stream everything that arrives at
-`web_notifications_1` directly to the client by invoking the `received`
+`web_notifications:1` directly to the client by invoking the `received`
callback.
### Subscriptions
@@ -311,7 +313,7 @@ App.cable.subscriptions.create { channel: "ChatChannel", room: "Best Room" },
```ruby
# Somewhere in your app this is called, perhaps
# from a NewCommentJob.
-ChatChannel.broadcast_to(
+ActionCable.server.broadcast(
"chat_#{room}",
sent_by: 'Paul',
body: 'This is a cool chat app.'
@@ -331,7 +333,7 @@ class ChatChannel < ApplicationCable::Channel
end
def receive(data)
- ChatChannel.broadcast_to("chat_#{params[:room]}", data)
+ ActionCable.server.broadcast("chat_#{params[:room]}", data)
end
end
```