     '$http'
     'notify'
     '$q'
-    ($rootScope, $state, $window, $http, notify, $q) ->
+    '$timeout'
+    ($rootScope, $state, $window, $http, notify, $q, $timeout) ->
         $rootScope.$state = $state
         $rootScope.$http = $http
 

                    point.data = data.gamePoint

            $rootScope.socket.on 'user:update', (data) ->
                if data.energy then $rootScope.energy = data.energy
                $rootScope.$apply()
]


        # Handle websockets
        $rootScope.socket = io wsUrl

        fnTimeout = ->
            console.log $rootScope.socket.connected
            if !$rootScope.socket.connected
                $timeout ->
                    window.location.reload false
                , 3000
            else
                $rootScope.wsCheck = $timeout fnTimeout, 1000

        $rootScope.wsCheck = $timeout fnTimeout, 1000


        $rootScope.socket.on 'notification:send', (data) ->
            notify "Hello there "+data

