         host: '0.0.0.0'
         timeout: 2000
 
-    rooms: {}
+    connections: {}
 
     constructor: (options) ->
         @options = _.extend {}, @options, options


        connection.on 'message', _.bind @message, @, connection

    disconnect: (cn, roomId, clientId)->
        cn.on 'close', =>
            delete @rooms[roomId][clientId]
            delete @rooms[roomId] if _.isEmpty @rooms[roomId]

    message: (cn, data)->
        mes = null


        if mes.host is 'tunnel'
            switch mes.pathname
                when '/connect' then @connect cn, mes.query

        else
            @tunnelMessage cn, mes, data

    connect: (cn, q)->
        clientId = q.client or @getUID 'c'
        clientId = @getUID 'c' if @connections[clientId]

        @connections[clientId] = cn

        clearTimeout cn._startTO
        @disconnect cn, clientId
        @response cn, null, 'tunnel', '/created', client: clientId

    tunnelMessage: (cn, mes, data)->
        return if not mes.host or not @connections[mes.host]
        @connections[mes.host].send data

    response: (cn, c, h, m, q)->
        return unless h
