Thruway\Peer\Client::onClose PHP Method

onClose() public method

Handle close session
public onClose ( mixed $reason )
$reason mixed
    public function onClose($reason)
    {
        if (isset($this->session)) {
            $this->onSessionEnd($this->session);
            $this->session->onClose();
            $this->session = null;
            $this->emit('close', [$reason]);
        }
        $this->roles = [];
        $this->callee = null;
        $this->caller = null;
        $this->subscriber = null;
        $this->publisher = null;
        $this->retryConnection();
    }

Usage Example

Example #1
0
 /**
  * @inheritDoc
  */
 public function onClose($reason)
 {
     $this->socket->shutdown();
     parent::onClose($reason);
 }