aboutsummaryrefslogtreecommitdiffstats
path: root/lib/assets/javascripts/cable.js.coffee
blob: 86e08e15c0c6701800102bfcabc1f3c8ef388b02 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#= 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

  send: (data) ->
    @connection.send(data)