kyubotics / coolq-http-api

为 酷Q 提供通过 HTTP 或 WebSocket 接收事件和调用 API 的能力
https://cqhttp.cc/docs/
GNU General Public License v3.0
1.85k stars 308 forks source link

反向 WebSocket(API)客户端连接失败或异常断开;[W] [反向WS] 反向 WebSocket(Event)客户端连接失败或异常断开 #269

Closed NiuYaNan closed 4 years ago

NiuYaNan commented 4 years ago

控制台输出如下: C:\QQrobot>C:/Users/Administrator/AppData/Local/Programs/Python/Python37/python.exe c:/QQrobot/test.py ujson module not found, using json [2020-01-03 11:26:04,697 nonebot] INFO: Succeeded to import "nonebot.plugins.base" [2020-01-03 11:26:04,697 nonebot] INFO: Running on 127.0.0.1:8080 Running on https://127.0.0.1:8080 (CTRL + C to quit) [2020-01-03 11:26:04,698] ASGI Framework Lifespan error, continuing without Lifespan support [2020-01-03 11:26:04,703] 127.0.0.1:55729 GET /ws/event 1.1 301 185 975 [2020-01-03 11:26:07,173] 127.0.0.1:55730 GET /ws/api 1.1 301 181 0 [2020-01-03 11:26:07,735] 127.0.0.1:55731 GET /ws/event 1.1 301 185 0 [2020-01-03 11:26:10,183] 127.0.0.1:55732 GET /ws/api 1.1 301 181 0 [2020-01-03 11:26:10,738] 127.0.0.1:55733 GET /ws/event 1.1 301 185 0 [2020-01-03 11:26:13,198] 127.0.0.1:55737 GET /ws/api 1.1 301 181 0 ......之后是无限的event api event api event......

NiuYaNan commented 4 years ago

更改HTTP API配置如下: "ws_reverse_api_url": "ws://127.0.0.1:8083/ws/api/", "ws_reverse_event_url": "ws://127.0.0.1:8083/ws/event/", "use_ws_reverse": true,

NiuYaNan commented 4 years ago

本地相同的配置运行没问题,控制台输出正常,就是搬到服务器上控制台输出老是这样,发消息机器人接收不到,求帮忙(╥╯^╰╥)

stdrc commented 4 years ago

@NiuYaNan 你这个配置文件是 8083 端口,而 NoneBot 是运行在 8080 端口?

NiuYaNan commented 4 years ago

@NiuYaNan 你这个配置文件是 8083 端口,而 NoneBot 是运行在 8080 端口?

哇我不小心复制错了,因为它一直这样我想会不会是端口原因于是把8080改成了8383......现在配置文件和Nonebot都是8080,重新运行后控制台输出也还是跟我上面讲的一样的情况。真的不知道该怎么办了QAQ

NiuYaNan commented 4 years ago

@NiuYaNan 你这个配置文件是 8083 端口,而 NoneBot 是运行在 8080 端口?

同样的代码在我本机可以顺利运行,搬到服务器上控制台输出就是这样。叫不到机器人,它也收不到消息。

stdrc commented 4 years ago

[2020-01-03 11:26:04,703] 127.0.0.1:55729 GET /ws/event 1.1 301 185 975

这边是 301,你是不是服务器上 ws://127.0.0.1:8083/ws/api/ 结尾的 / 丢了

NiuYaNan commented 4 years ago

[2020-01-03 11:26:04,703] 127.0.0.1:55729 GET /ws/event 1.1 301 185 975

这边是 301,你是不是服务器上 ws://127.0.0.1:8083/ws/api/ 结尾的 / 丢了 看了一下确实是的!加上/现在可以了!大佬好棒www感谢!!