         if @messageBusList[namespace]
             messageBus = @messageBusList[namespace]
         else
-            messageBus = new SenderMessageBus @defMessageChannel, namespace
+            messageBus = new SenderMessageBus @messageChannel, namespace
             @messageBusList[namespace] = messageBus
         return messageBus
 
-    createPeer: ->
+    _createPeer: ->
         peer = new Peer
             host: @host
             port: '9433'


class FlintSenderManager extends EventEmitter

    constructor: (@appId, @device, @useHeartbeat) ->
        if not @appId or not @device
            throw 'FlintSenderManager constructor error'

        @urlBase = @device.urlBase
        @serviceUrl = @urlBase + '/apps/' + @appId
        @host = @device.host

        if @useHeartbeat is undefined
            @useHeartbeat = true

        @appState = {}
        @additionalData = {}

        return peer

    _clean: ->
        @messageChannel?.close()
        @messageChannel = null
        @messageBusList = null

module.exports = FlintSenderManager