setImplementation() public method

Set protocol implementation.
public setImplementation ( Fabiang\Xmpp\Protocol\ImplementationInterface $implementation )
$implementation Fabiang\Xmpp\Protocol\ImplementationInterface
Ejemplo n.º 1
0
 public function getClient($host, $username = null, $password = null)
 {
     $address = "tcp://{$host}:5222";
     $options = new Options($address);
     if ($this->logger) {
         $options->setLogger($this->logger);
     }
     if ($username && $password) {
         $this->log("Logging with {$username} | {$password}");
         $options->setUsername($username)->setPassword($password);
         $options->setImplementation(new AuthenticatedImplementation());
     } else {
         $options->setImplementation(new AnonymousImplementation());
         $options->setAuthenticationClasses([]);
     }
     $client = new Client($options);
     $client->connect();
     return $client;
 }