使用频道和 django 的聊天应用程序

问题描述 投票:0回答:0

我正在关注频道页面上的教程https://channels.readthedocs.io/en/stable/tutorial/part_1.html 但在第二部分结束时,websocket 应该可以工作,但在我的例子中它说: 与“ws://127.0.0.1:8000/ws/chat/lobby/”的 WebSocket 连接失败:

在后端我得到: [23/Feb/2023 17:01:28] “GET /chat/lobby/ HTTP/1.1” 200 1660 未找到:/ws/chat/lobby/ [23/Feb/2023 17:01:28] “GET /ws/chat/lobby/ HTTP/1.1” 404 2226

当键入“你好”时,我应该得到:键入消息“你好”并按回车键。您现在应该会在聊天记录中看到“你好”的回声。

django django-channels channels
© www.soinside.com 2019 - 2024. All rights reserved.