private function getLocation(ConnectionInterface $conn) {

        if($conn->WebSocket instanceof \StdClass) {

            if(($cache = $this->cacheService) != null) {

                $ip = $this->getIpAddress($conn);

                // load geo location from cache
                if($cache->getStorage()->exists($ip) === true) {
                    $location = $cache->getStorage()->get($ip);
                }

                // add to cache geo location
                $cache->getStorage()->save($ip, $this->geoService->location($ip));
            }
            else {
                try {
                    $location = $this->geoService->location($this->getIpAddress($conn));
                }
                catch(GeoServiceException $e) {
                    throw new AppServiceException($e->getMessage());
                }
            }
            return $location;
        }
        throw new AppServiceException('Location not defined');
    }
private function getLocation(ConnectionInterface $conn) {

        if($conn->WebSocket instanceof \StdClass) {

            if(($cache = $this->cacheService) != null) {

                $ip = $this->getIpAddress($conn);

                // load geo location from cache
                if($cache->getStorage()->exists($ip) === true) {
                    $location = $cache->getStorage()->get($ip);
                }

                // add to cache geo location
                $cache->getStorage()->save($ip, $this->geoService->location($ip));
            }
            else {
                try {
                    $location = $this->geoService->location($this->getIpAddress($conn));
                }
                catch(GeoServiceException $e) {
                    throw new AppServiceException($e->getMessage());
                }
            }
            return $location;
        }
        throw new AppServiceException('Location not defined');
    }
private function getLocation ( ConnectionInterface $ conn ) { if ( $ conn -> WebSocket instanceof \ StdClass ) { if ( ( $ cache = $ this -> cacheService ) != null ) { $ ip = $ this -> getIpAddress ( $ conn ) ; // load geo location from cache if ( $ cache -> getStorage ( ) -> exists ( $ ip ) === true ) { $ location = $ cache -> getStorage ( ) -> get ( $ ip ) ; } // add to cache geo location $ cache -> getStorage ( ) -> save ( $ ip , $ this -> geoService -> location ( $ ip ) ) ; } else { try { $ location = $ this -> geoService -> location ( $ this -> getIpAddress ( $ conn ) ) ; } catch ( GeoServiceException $ e ) { throw new AppServiceException ( $ e -> getMessage ( ) ) ; } } return $ location ; } throw new AppServiceException ( 'Location not defined' ) ; }
Get user location

@param ConnectionInterface $conn
@throws \Sonar\Exceptions\AppServiceException
@return string
Get user location