/** * Constructor * * @param \React\EventLoop\LoopInterface $loop */ public function __construct(LoopInterface $loop = null) { Utils::checkPrecision(); $this->loop = $loop ?: Factory::create(); $this->realmManager = new RealmManager(); $this->eventDispatcher = new EventDispatcher(); $this->eventDispatcher->addSubscriber($this); $this->registerModule($this->realmManager); Logger::debug($this, "New router created"); }
/** * Constructor * * @param string $realm * @param \React\EventLoop\LoopInterface $loop */ public function __construct($realm, LoopInterface $loop = null) { Utils::checkPrecision(); $this->realm = $realm; $this->loop = $loop ? $loop : Factory::create(); $this->transportProvider = null; $this->roles = []; $this->authMethods = []; $this->session = null; $this->clientAuthenticators = []; $this->authId = "anonymous"; $this->reconnectOptions = ["max_retries" => 15, "initial_retry_delay" => 1.5, "max_retry_delay" => 300, "retry_delay_growth" => 1.5, "retry_delay_jitter" => 0.1]; $this->on('open', [$this, 'onSessionStart']); Logger::info($this, "New client created"); }