Esempio n. 1
0
 /**
  * @recoil-coroutine
  */
 public function start() : Generator
 {
     // start a strand that deals with the main connection logic ...
     $strand = (yield Recoil::execute($this->readLoop()));
     // if heartbeats are enabled, start an additional strand that checks
     // the heartbeat state at the negotiated interval ...
     if ($this->tune->heartbeat !== HandshakeManager::HEARTBEAT_DISABLED) {
         (yield Recoil::link($strand, (yield Recoil::execute($this->heartbeatLoop()))));
     }
 }