blob: b9c08807f246345b2d5d27d974d76856a2d54c4b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#= require cable/connection
#= require cable/connection_monitor
#= require cable/subscription
#= require cable/subscriber_manager
class Cable.Consumer
constructor: (@url) ->
@subscribers = new Cable.SubscriberManager this
@connection = new Cable.Connection this
@connectionMonitor = new Cable.ConnectionMonitor this
createSubscription: (channelName, mixin) ->
channel = channelName
params = if typeof channel is "object" then channel else {channel}
new Cable.Subscription this, params, mixin
send: (data) ->
@connection.send(data)
|