/**
* Constructor
*
* @param array $options
* @param \React\EventLoop\LoopInterface $loop
* @throws \Exception
*/
public function __construct(array $options, LoopInterface $loop = null)
{
$this->options = $options;
$this->client = new Client($options['realm'], $loop);
$url = isset($options['url']) ? $options['url'] : null;
$pawlTransport = new PawlTransportProvider($url);
$this->client->addTransportProvider($pawlTransport);
$this->client->setReconnectOptions($options);
//Set Authid
if (isset($options['authid'])) {
$this->client->setAuthId($options['authid']);
}
//Register Handlers
$this->handleOnChallenge();
$this->handleOnOpen();
$this->handleOnClose();
$this->handleOnError();
}