public function heartbeat()
    {
        $this->logger->debug('sending heartbeat', ['seq' => $this->seq]);

        $payload = [
            'op' => Op::OP_HEARTBEAT,
            'd'  => $this->seq,
        ];

        $this->send($payload);
        $this->heartbeatTime = microtime(true);
        $this->emit('heartbeat', [$this->seq, $this]);

        $this->heartbeatAckTimer = $this->loop->addTimer($this->heartbeatInterval / 1000, function () {
            if (! $this->connected) {
                return;
            }

            $this->logger->warning('did not receive heartbeat ACK within heartbeat interval, closing connection');
            $this->ws->close(1001, 'did not receive heartbeat ack');
        });
    }
public function heartbeat()
    {
        $this->logger->debug('sending heartbeat', ['seq' => $this->seq]);

        $payload = [
            'op' => Op::OP_HEARTBEAT,
            'd'  => $this->seq,
        ];

        $this->send($payload);
        $this->heartbeatTime = microtime(true);
        $this->emit('heartbeat', [$this->seq, $this]);

        $this->heartbeatAckTimer = $this->loop->addTimer($this->heartbeatInterval / 1000, function () {
            if (! $this->connected) {
                return;
            }

            $this->logger->warning('did not receive heartbeat ACK within heartbeat interval, closing connection');
            $this->ws->close(1001, 'did not receive heartbeat ack');
        });
    }
public function heartbeat ( ) { $ this -> logger -> debug ( 'sending heartbeat' , [ 'seq' => $ this -> seq ] ) ; $ payload = [ 'op' => Op :: OP_HEARTBEAT , 'd' => $ this -> seq , ] ; $ this -> send ( $ payload ) ; $ this -> heartbeatTime = microtime ( true ) ; $ this -> emit ( 'heartbeat' , [ $ this -> seq , $ this ] ) ; $ this -> heartbeatAckTimer = $ this -> loop -> addTimer ( $ this -> heartbeatInterval / 1000 , function ( ) { if ( ! $ this -> connected ) { return ; } $ this -> logger -> warning ( 'did not receive heartbeat ACK within heartbeat interval, closing connection' ) ; $ this -> ws -> close ( 1001 , 'did not receive heartbeat ack' ) ; } ) ; }
Sends a heartbeat packet to the Discord gateway.

@return void
Sends a heartbeat packet to the Discord gateway .