         return unless id of @lobbies_by_id
         @lobbies_by_id[id].sendChat(id, text)
 LobbyManager = new LobbyManagerGlobal()
-setInterval(->
-    try
-        LobbyManager.matchmake()
-    catch err
-        console.log('Exception: ' + err)
-, 5000)
+setInterval(LobbyManager.matchmake, 5000)
 
 class GlobalLobbyGlobal
     constructor: ->

sqlite3 = require('sqlite3')
util = require('util')
_ = require('underscore')

class Player
    constructor: (socket, request) ->

        )
UserProfiles = new UserProfilesGlobal()

class GameServer
    start: ->
        @io = socketio.listen(5000)
        @io.set('log level', 2)
        @io.sockets.on('connection', (socket) =>
            fns = _.functions(this)
            fns = _.reject(fns, (fn) -> fn is 'start' or fn[0] is '_')
            socket.on(fn, this._event(this[fn], socket)) for fn in fns
        )

    _event: (fn, socket) ->
        return ->
            args = _.toArray(arguments)
            args.unshift(socket)
            try
                return fn.apply(this, args)
            catch err
                logError(err)
        
    joinGlobalLobby: (socket, req, cb) =>
        if req is null
            cb(GlobalLobby.addAnon(socket))
        else
            UserProfiles.get(req.profile_url, (err, profile) ->
                return if err
                req.league = profile.league
                player = new Player(socket, req)
                cb(GlobalLobby.addPlayer(player))
            )

    getUserProfile: (socket, profile_url, cb) =>
        UserProfiles.get(profile_url, cb)

    createLobby: (socket, req, cb) =>
        UserProfiles.get(req.profile_url, (err, profile) ->
            return if err
            req.league = profile.league
