public function handleVoiceServerChange(array $data = [])
    {
        $this->logger->debug('voice server has changed, dynamically changing servers in the background', ['data' => $data]);
        $this->reconnecting   = true;
        $this->sentLoginFrame = false;
        $this->pause();

        $this->client->close();
        $this->voiceWebsocket->close();

        $this->loop->cancelTimer($this->heartbeat);
        $this->loop->cancelTimer($this->udpHeartbeat);

        $this->data['token'] = $data['token']; // set the token if it changed
        $this->endpoint      = str_replace([':80', ':443'], '', $data['endpoint']);

        $this->initSockets();

        $this->on('resumed', function () {
            $this->logger->debug('voice client resumed');
            $this->unpause()->then(function () {
                $this->speaking = false;
                $this->setSpeaking(true);
            });
        });
    }
public function handleVoiceServerChange(array $data = [])
    {
        $this->logger->debug('voice server has changed, dynamically changing servers in the background', ['data' => $data]);
        $this->reconnecting   = true;
        $this->sentLoginFrame = false;
        $this->pause();

        $this->client->close();
        $this->voiceWebsocket->close();

        $this->loop->cancelTimer($this->heartbeat);
        $this->loop->cancelTimer($this->udpHeartbeat);

        $this->data['token'] = $data['token']; // set the token if it changed
        $this->endpoint      = str_replace([':80', ':443'], '', $data['endpoint']);

        $this->initSockets();

        $this->on('resumed', function () {
            $this->logger->debug('voice client resumed');
            $this->unpause()->then(function () {
                $this->speaking = false;
                $this->setSpeaking(true);
            });
        });
    }
public function handleVoiceServerChange ( array $ data = [ ] ) { $ this -> logger -> debug ( 'voice server has changed, dynamically changing servers in the background' , [ 'data' => $ data ] ) ; $ this -> reconnecting = true ; $ this -> sentLoginFrame = false ; $ this -> pause ( ) ; $ this -> client -> close ( ) ; $ this -> voiceWebsocket -> close ( ) ; $ this -> loop -> cancelTimer ( $ this -> heartbeat ) ; $ this -> loop -> cancelTimer ( $ this -> udpHeartbeat ) ; $ this -> data [ 'token' ] = $ data [ 'token' ] ; // set the token if it changed $ this -> endpoint = str_replace ( [ ':80' , ':443' ] , '' , $ data [ 'endpoint' ] ) ; $ this -> initSockets ( ) ; $ this -> on ( 'resumed' , function ( ) { $ this -> logger -> debug ( 'voice client resumed' ) ; $ this -> unpause ( ) -> then ( function ( ) { $ this -> speaking = false ; $ this -> setSpeaking ( true ) ; } ) ; } ) ; }
Handles a voice server change.

@param array $data New voice server information.

@return void
Handles a voice server change .