public function onClose(ConnectionInterface $conn) {

        // The connection is closed, remove it, as we can no longer send it messages
        $this->clients->detach($conn);

        // pulled data from queues
        $data = $this->queueService->pull([
            // identity for open queue message
                'hash'        =>  md5($this->getIpAddress($conn).$this->getUserAgent($conn)),
            ], function($response) use ($conn) {

            return array_merge($response, [
                'ua'            => $this->getUserAgent($conn),
                'language'      => $this->getLanguage($conn),
                'location'      => $this->getLocation($conn),
                'close'         => time()
            ]);
        });

        // save data to storage
        $this->storageService->add($data);

        echo Messenger::close($this->getIpAddress($conn));

        // end profiler
        if(defined('SONAR_VERBOSE') === true) {
            Profiler::finish();
            Profiler::getProfilingData();
        }
    }
public function onClose(ConnectionInterface $conn) {

        // The connection is closed, remove it, as we can no longer send it messages
        $this->clients->detach($conn);

        // pulled data from queues
        $data = $this->queueService->pull([
            // identity for open queue message
                'hash'        =>  md5($this->getIpAddress($conn).$this->getUserAgent($conn)),
            ], function($response) use ($conn) {

            return array_merge($response, [
                'ua'            => $this->getUserAgent($conn),
                'language'      => $this->getLanguage($conn),
                'location'      => $this->getLocation($conn),
                'close'         => time()
            ]);
        });

        // save data to storage
        $this->storageService->add($data);

        echo Messenger::close($this->getIpAddress($conn));

        // end profiler
        if(defined('SONAR_VERBOSE') === true) {
            Profiler::finish();
            Profiler::getProfilingData();
        }
    }
public function onClose ( ConnectionInterface $ conn ) { // The connection is closed, remove it, as we can no longer send it messages $ this -> clients -> detach ( $ conn ) ; // pulled data from queues $ data = $ this -> queueService -> pull ( [ // identity for open queue message 'hash' => md5 ( $ this -> getIpAddress ( $ conn ) . $ this -> getUserAgent ( $ conn ) ) , ] , function ( $ response ) use ( $ conn ) { return array_merge ( $ response , [ 'ua' => $ this -> getUserAgent ( $ conn ) , 'language' => $ this -> getLanguage ( $ conn ) , 'location' => $ this -> getLocation ( $ conn ) , 'close' => time ( ) ] ) ; } ) ; // save data to storage $ this -> storageService -> add ( $ data ) ; echo Messenger :: close ( $ this -> getIpAddress ( $ conn ) ) ; // end profiler if ( defined ( 'SONAR_VERBOSE' ) === true ) { Profiler :: finish ( ) ; Profiler :: getProfilingData ( ) ; } }
Close conversation event

@param ConnectionInterface $conn
Close conversation event