/** * Run the server * * @return void */ function run() { global $version; $time = strftime("%Y-%m-%d %H:%M:%S"); $v = $version['string']; $motd = <<<EOT ------------------------------------------------------- | Welcome to the Mediboard {$this->getServerType()} Server v.{$v} | | Started at {$time} | ------------------------------------------------------- EOT; $this->started_datetime = $time; $server = $this->server->bind("0.0.0.0", $this->port, $this->certificate, $this->passphrase, $this->certificate_authority); $server->setRequestHandler(array($this, "handle")); $server->setOnOpenHandler(array($this, "onOpen")); $server->setOnCleanupHandler(array($this, "onCleanup")); $server->setOnCloseHandler(array($this, "onClose")); $server->setOnWriteErrorHandler(array($this, "writeError")); $server->run(); }