React\Socket\Connection::handleClose PHP Method

handleClose() public method

public handleClose ( )
    public function handleClose()
    {
        if (is_resource($this->stream)) {
            // http://chat.stackoverflow.com/transcript/message/7727858#7727858
            stream_socket_shutdown($this->stream, STREAM_SHUT_RDWR);
            stream_set_blocking($this->stream, false);
            fclose($this->stream);
        }
    }

Usage Example

 public function handleClose()
 {
     parent::handleClose();
     $this->connectionTimer->cancel();
 }