尝试连接到另一台服务器时达到空闲超时

问题描述

我想做一个网站并在其中集成 RocketChat 服务器。我的应用程序在 localhost:2222 服务器上运行(使用 Laragon 应用程序生成),我的 RocketChat 服务器在 localhost:3000 上使用适用于 Linux 的 Windows 子系统运行。

问题是,当我尝试从我的 localhost:2222 向 RocketChat 的 localhost:3000 发送请求时,我收到错误 Idle timeout reached for "http://localhost:3000/api/v1/login"。我为此工作了好几天,但我仍然不知道如何解决它:(

这是我想在 "/api/v1/user/login" 路由中发送的请求:

   class InBoxController extends AbstractController
{
    const RocketChatServer = 'http://localhost:3000/api/v1';
    /**
     * @Route("/inBox",name="inBox")
     */
    public function index(): Response
    {
        return $this->render('inBox.html.twig',[
            'controller_name' => 'InBoxController',]);
    }

    /**
     * @Route ("/api/v1/user/login",name="rocket_login",methods={"POST"})
     */
    public function login(Request $request){
        $client =HttpClient::create();
        $loginRequest = $client->request('POST',self::RocketChatServer . "/login",[
            'json' => [
                'user' => 'username','password' => 'password'
            ],]);

        return new JsonResponse([
            'message' => 'User logged id'
        ]);
    }
}

你能告诉我为什么我会收到这个错误,我该如何解决

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)