blob: 4c93f8f062d91359d5041fc4aa96f7e2dc1d762d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#= require_self
#= require cable/subscriber_manager
#= require cable/connection
#= require cable/channel
class @Cable
constructor: (@url) ->
@subscribers = new Cable.SubscriberManager this
@connection = new Cable.Connection this
createChannel: (channelName, mixin) ->
channel = channelName
params = if typeof channel is "object" then channel else {channel}
new Cable.Channel this, params, mixin
sendMessage: (identifier, data) ->
@sendCommand(identifier, "message", data)
sendCommand: (identifier, command, data) ->
@connection.send({identifier, command, data})
|