diff options
Diffstat (limited to 'lib/assets/javascripts/cable/consumer.js.coffee')
-rw-r--r-- | lib/assets/javascripts/cable/consumer.js.coffee | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/assets/javascripts/cable/consumer.js.coffee b/lib/assets/javascripts/cable/consumer.js.coffee index 27314ee508..b01ae586aa 100644 --- a/lib/assets/javascripts/cable/consumer.js.coffee +++ b/lib/assets/javascripts/cable/consumer.js.coffee @@ -1,11 +1,23 @@ #= require cable/connection #= require cable/connection_monitor +#= require cable/subscriptions #= require cable/subscription -#= require cable/subscriber_manager +# The Cable.Consumer establishes the connection to a server-side Ruby Connection object. Once established, +# the Cable.ConnectionMonitor will ensure that its properly maintained through heartbeats and checking for stale updates. +# The Consumer instance is also the gateway to establishing subscriptions to desired channels through the #createSubscription +# method. +# +# The following example shows how this can be setup: +# +# @App = {} +# App.cable = Cable.createConsumer "http://example.com/accounts/1" +# App.appearance = App.cable.createSubscription "AppearanceChannel" +# +# For more details on how you'd configure an actual channel subscription, see Cable.Subscription. class Cable.Consumer constructor: (@url) -> - @subscribers = new Cable.SubscriberManager this + @subscriptions = new Cable.Subscriptions this @connection = new Cable.Connection this @connectionMonitor = new Cable.ConnectionMonitor this @@ -21,4 +33,4 @@ class Cable.Consumer JSON.stringify(this, null, 2) toJSON: -> - {@url, @subscribers, @connection, @connectionMonitor} + {@url, @subscriptions, @connection, @connectionMonitor} |