container = $container; } public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { // 授权验证拦截握手请求并实现权限检查 $token = $request->getQueryParams()['token'] ?? ''; try { $this->jwt->checkToken($token); } catch (\Exception $e) { return $this->container->get(\Hyperf\HttpServer\Contract\ResponseInterface::class)->raw('Forbidden'); } return $handler->handle($request); } }