             # First msg should be the client's browserID
             console.log("Socket.io client handshake: #{browserID}")
             # Look up the client's BrowserInstance
-            browsers.find encodeURIComponent(browserID), (browser) ->
+            browsers.find decodeURIComponent(browserID), (browser) ->
                 # clientConnected processes client's messages.
                 browser.addClient(client)
 

    server = express.createServer()
    server.get '*', (req, res, next) ->
        reqPath = req.params[0]
        contentType = null
        if /\.js$/.test(reqPath)
            contentType = 'text/javascript'
        else if /\.html$/.test(reqPath)
            contentType = 'text/html'
        else if /\.css$/.test(reqPath)
            contentType = 'text/css'
        else
            next()
        if contentType != null
            pagePath = path.join(process.cwd(), 'html', reqPath)

    server.listen 3001, ->
        console.log 'Internal HTTP server listening on port 3001 [TODO: remove this].'
    server

getContentType = (str) ->
    contentType = null
    if /\.js$/.test(str)
        contentType = 'text/javascript'
    else if /\.html$/.test(str)
        contentType = 'text/html'
    else if /\.css$/.test(str)
        contentType = 'text/css'
    return contentType


socketio = do ->
    numCurrentUsers = 0
