This commit is contained in:
2021-02-20 16:15:01 +08:00
parent f672fab504
commit dc1b7a9c0b
2 changed files with 5 additions and 2 deletions
+3 -1
View File
@@ -7,6 +7,7 @@ namespace HttpServer\Events;
use Annotation\Route\Socket; use Annotation\Route\Socket;
use Exception; use Exception;
use HttpServer\Abstracts\Callback; use HttpServer\Abstracts\Callback;
use HttpServer\Http\Context;
use Snowflake\Event; use Snowflake\Event;
use Snowflake\Exception\ComponentException; use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake; use Snowflake\Snowflake;
@@ -63,7 +64,8 @@ class OnMessage extends Callback
throw new Exception('Format error.'); throw new Exception('Format error.');
} }
$router = Snowflake::app()->getRouter(); $router = Snowflake::app()->getRouter();
$node = $router->search('/' . Socket::MESSAGE . '::' . $route, 'sw::socket');
$node = $router->tree_search(explode('/', Socket::MESSAGE . '::' . $route), 'sw::socket');
if ($node === null) { if ($node === null) {
throw new Exception('Page not found.'); throw new Exception('Page not found.');
} }
+2 -1
View File
@@ -7,6 +7,7 @@ use Exception;
use HttpServer\Application; use HttpServer\Application;
use HttpServer\IInterface\AuthIdentity; use HttpServer\IInterface\AuthIdentity;
use JetBrains\PhpStorm\Pure;
use ReflectionException; use ReflectionException;
use Snowflake\Core\Json; use Snowflake\Core\Json;
use Snowflake\Exception\ComponentException; use Snowflake\Exception\ComponentException;
@@ -202,7 +203,7 @@ class Request extends Application
/** /**
* @return string * @return string
*/ */
public function getCurrent(): string #[Pure] public function getCurrent(): string
{ {
return current($this->explode); return current($this->explode);
} }