diff --git a/README.md b/README.md index 50055fba1094ccf9bdaac33db01c3afc17c3ec0a..c0d91fdba4e373697b06b6cadea475acb55d3a0f 100644 --- a/README.md +++ b/README.md @@ -173,12 +173,12 @@ class WebNotificationsChannel < ApplicationCable::Channel ```coffeescript # 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' } + "web_notifications_1", { title: 'New things!', body: 'All shit fit for print' } # Client-side which assumes you've already requested the right to send web notifications App.cable.subscriptions.create "WebNotificationsChannel", - received: (data) -> - web_notification = new Notification data['title'], body: data['body'] + received: (data) -> + new Notification data['title'], body: data['body'] ``` The `ActionCable.server.broadcast` call places a message in the Redis' pubsub queue under the broadcasting name of `web_notifications_1`. diff --git a/lib/action_cable/server/broadcasting.rb b/lib/action_cable/server/broadcasting.rb index de13e265113d820c6c5fe6b7c7ce48fae3691e5e..4f72ffd96fca4d99ad2689a18b9400674e23331d 100644 --- a/lib/action_cable/server/broadcasting.rb +++ b/lib/action_cable/server/broadcasting.rb @@ -16,7 +16,7 @@ module Server # # Client-side coffescript which assumes you've already requested the right to send web notifications # App.cable.subscriptions.create "WebNotificationsChannel", # received: (data) -> - # web_notification = new Notification data['title'], body: data['body'] + # new Notification data['title'], body: data['body'] module Broadcasting # Broadcast a hash directly to a named broadcasting. It'll automatically be JSON encoded. def broadcast(broadcasting, message)