requestBuffer); unset($connection->contentLength); unset($connection->request); } public function onError(ConnectionInterface $connection, Exception $e) { } public function onMessage(ConnectionInterface $from, $msg) { } protected function getView(string $view, array $data) { $templatePath = implode(DIRECTORY_SEPARATOR, explode('.', $view)); $twig = new Environment( new ArrayLoader([ 'template' => file_get_contents(base_path('resources/views/'.$templatePath.'.twig')), ]) ); return stream_for($twig->render('template', $data)); } }