8889841cclixcotz/mars.clix.co.tz/vendor/beyondcode/laravel-websockets/src/Server/WebSocketServerFactory.php000066600000004446150515677220030616 0ustar00homeloop = LoopFactory::create(); } public function useRoutes(RouteCollection $routes) { $this->routes = $routes; return $this; } public function setHost(string $host) { $this->host = $host; return $this; } public function setPort(string $port) { $this->port = $port; return $this; } public function setLoop(LoopInterface $loop) { $this->loop = $loop; return $this; } public function setConsoleOutput(OutputInterface $consoleOutput) { $this->consoleOutput = $consoleOutput; return $this; } public function createServer(): IoServer { $socket = new Server("{$this->host}:{$this->port}", $this->loop); if (config('websockets.ssl.local_cert')) { $socket = new SecureServer($socket, $this->loop, config('websockets.ssl')); } $urlMatcher = new UrlMatcher($this->routes, new RequestContext); $router = new Router($urlMatcher); $app = new OriginCheck($router, config('websockets.allowed_origins', [])); $httpServer = new HttpServer($app, config('websockets.max_request_size_in_kb') * 1024); if (HttpLogger::isEnabled()) { $httpServer = HttpLogger::decorate($httpServer); } return new IoServer($httpServer, $socket, $this->loop); } }