 class Channel
   constructor: (@name, @app) ->
     @pubsub = new PubSub @app.vines.xmpp, @app.pubsub, @name
-    @subscribers = []
+    @subscribers = 0
+    @listeners = []
     @subscription = null
 
   subscribe: (fn) ->
-    @subscribers.push fn
+    @listeners.push fn
     @subscription ||= @app.vines.xmpp.addHandler(
       ((node) => this.notify node), null, 'message', null, null, @app.pubsub)
     @pubsub.create()

        publisher: from
        payload: JSON.parse payload.text()
        node: node
      sub obj for sub in @subscribers
    true # keep handler alive

    @pubsub.publish obj

  unsubscribe: ->
    @listeners = []
    @app.vines.xmpp.deleteHandler @subscription
    @subscription = null
    @pubsub.unsubscribe()

  remove: ->
    this.unsubscribe()
    @pubsub.remove()

  notify: (node) ->
    node    = $ node
