                     ws.close()
 
     # close channel
-    closeChannel: (channelId) ->
-        console.log "close channel : ", channelId
+    _closeChannel: (channelId) ->
+        Log.i "close channel : ", channelId
         @channels[channelId].close()
         delete @channels[channelId]
 
     # receiver
-    newReceiverConnection: (channelId, ws) ->
-        console.log "New receiver connection ", channelId
+    _newReceiverConnection: (channelId, ws) ->
+        Log.i "New receiver connection ", channelId
 
-        @closeChannel channelId if @channels[channelId]
+        @_closeChannel channelId if @channels[channelId]
 
         @channels[channelId] = new Channel channelId
         @channels[channelId].setReceiverConn ws
 
     # sender
-    newSenderConnection: (channelId, senderId, ws) ->
-        console.log "New sender connection ", channelId, senderId
+    _newSenderConnection: (channelId, senderId, ws) ->
+        Log.i "New sender connection ", channelId, senderId
         if @channels[channelId]
             @channels[channelId].addSenderConn senderId, ws
         else


        @wss = new (require('ws').Server) { port: @port }
        @wss.on 'connection', (ws) =>
            console.log 'New connection ', ws.upgradeReq.url
            router.dispatch ws.upgradeReq.url, (err, packet) =>
                if not err
                    channelId = packet.params.channelId
                    senderId = packet.params.senderId
                    if senderId
                        @newSenderConnection channelId, senderId, ws
                    else
                        @newReceiverConnection channelId, ws
                else
                    ws.send JSON.stringify
                        type: 'error'

    close: ->
        @rxconn.close() # senders connection close soon

    setReceiverConn: (rxconn) ->
        @rxconn = rxconn
        @rxconn.on 'message', (message) =>
            Log.i 'Receive receiver message : ', message
            messageObj = JSON.parse message
            senderId = messageObj.senderId
            txconn = @txconn[senderId]
            if txconn
                txconn.send JSON.stringify message.data
            else
                @_respReceiverError 'Invalid sender id'

        @rxconn.on 'close', =>
            @rxconn = null
            @_closeSenders()

    addSenderConn: (senderId, senderConn) ->
        if @rxconn
