protected function identify($resume = true)
    {
        if ($resume && $this->reconnecting && ! is_null($this->sessionId)) {
            $payload = [
                'op' => Op::OP_RESUME,
                'd'  => [
                    'session_id' => $this->sessionId,
                    'seq'        => $this->seq,
                    'token'      => $this->token,
                ],
            ];

            $this->logger->info('resuming connection', ['payload' => $payload]);
        } else {
            $payload = [
                'op' => Op::OP_IDENTIFY,
                'd'  => [
                    'token'      => $this->token,
                    'properties' => [
                        '$os'               => PHP_OS,
                        '$browser'          => $this->http->getUserAgent(),
                        '$device'           => $this->http->getUserAgent(),
                        '$referrer'         => 'https://github.com/teamreflex/DiscordPHP',
                        '$referring_domain' => 'https://github.com/teamreflex/DiscordPHP',
                    ],
                    'compress' => true,
                ],
            ];

            if (array_key_exists('shardId', $this->options) &&
                array_key_exists('shardCount', $this->options)) {
                $payload['d']['shard'] = [
                    (int) $this->options['shardId'],
                    (int) $this->options['shardCount'],
                ];
            }

            $this->logger->info('identifying', ['payload' => $payload]);
        }

        $this->send($payload);

        return $payload['op'] == Op::OP_RESUME;
    }
protected function identify($resume = true)
    {
        if ($resume && $this->reconnecting && ! is_null($this->sessionId)) {
            $payload = [
                'op' => Op::OP_RESUME,
                'd'  => [
                    'session_id' => $this->sessionId,
                    'seq'        => $this->seq,
                    'token'      => $this->token,
                ],
            ];

            $this->logger->info('resuming connection', ['payload' => $payload]);
        } else {
            $payload = [
                'op' => Op::OP_IDENTIFY,
                'd'  => [
                    'token'      => $this->token,
                    'properties' => [
                        '$os'               => PHP_OS,
                        '$browser'          => $this->http->getUserAgent(),
                        '$device'           => $this->http->getUserAgent(),
                        '$referrer'         => 'https://github.com/teamreflex/DiscordPHP',
                        '$referring_domain' => 'https://github.com/teamreflex/DiscordPHP',
                    ],
                    'compress' => true,
                ],
            ];

            if (array_key_exists('shardId', $this->options) &&
                array_key_exists('shardCount', $this->options)) {
                $payload['d']['shard'] = [
                    (int) $this->options['shardId'],
                    (int) $this->options['shardCount'],
                ];
            }

            $this->logger->info('identifying', ['payload' => $payload]);
        }

        $this->send($payload);

        return $payload['op'] == Op::OP_RESUME;
    }
protected function identify ( $ resume = true ) { if ( $ resume && $ this -> reconnecting && ! is_null ( $ this -> sessionId ) ) { $ payload = [ 'op' => Op :: OP_RESUME , 'd' => [ 'session_id' => $ this -> sessionId , 'seq' => $ this -> seq , 'token' => $ this -> token , ] , ] ; $ this -> logger -> info ( 'resuming connection' , [ 'payload' => $ payload ] ) ; } else { $ payload = [ 'op' => Op :: OP_IDENTIFY , 'd' => [ 'token' => $ this -> token , 'properties' => [ '$os' => PHP_OS , '$browser' => $ this -> http -> getUserAgent ( ) , '$device' => $ this -> http -> getUserAgent ( ) , '$referrer' => 'https://github.com/teamreflex/DiscordPHP' , '$referring_domain' => 'https://github.com/teamreflex/DiscordPHP' , ] , 'compress' => true , ] , ] ; if ( array_key_exists ( 'shardId' , $ this -> options ) && array_key_exists ( 'shardCount' , $ this -> options ) ) { $ payload [ 'd' ] [ 'shard' ] = [ ( int ) $ this -> options [ 'shardId' ] , ( int ) $ this -> options [ 'shardCount' ] , ] ; } $ this -> logger -> info ( 'identifying' , [ 'payload' => $ payload ] ) ; } $ this -> send ( $ payload ) ; return $ payload [ 'op' ] == Op :: OP_RESUME ; }
Identifies with the Discord gateway with `IDENTIFY` or `RESUME` packets.

@param bool $resume Whether resume should be enabled.
Identifies with the Discord gateway with IDENTIFY or RESUME packets .