private function onAppError($clientId, \Throwable $e) : \Generator
{
$this->logger->error($e->__toString());
$code = Code::UNEXPECTED_SERVER_ERROR;
$reason = "Internal server error, aborting";
if (isset($this->clients[$clientId])) {
// might have been already unloaded + closed
yield from $this->doClose($this->clients[$clientId], $code, $reason);
}
}