我正在尝试使用 readthedocs channelshttps://channels.readthedocs.io/en/latest/tutorial/index.html中的本教程将一个简单的聊天室集成到我当前的网站项目中
当我尝试加载应该自动连接到全局聊天的网站主页时,我得到了这个
\n后端控制台
\nHTTP GET / 200 [0.01, 127.0.0.1:58286]\nHTTP GET /static/chatroom/base.css 304 [0.00, 127.0.0.1:58286]\nHTTP GET /static/chatroom/images/profiles/anonymous.jpg 304 [0.00, 127.0.0.1:58288]\nHTTP GET /static/chatroom/images/background.jpg 304 [0.00, 127.0.0.1:58288]\nWebSocket HANDSHAKING /ws/chat/global/ [127.0.0.1:58290]\nWebSocket DISCONNECT /ws/chat/global/ [127.0.0.1:58282]\nRun Code Online (Sandbox Code Playgroud)\nJavaScript 控制台
\nFirefox can\xe2\x80\x99t establish a connection to the server at ws://127.0.0.1:8000/ws/chat/global/. 127.0.0.1:8000:59:23\nSocket error: [object WebSocket] 127.0.0.1:8000:69:17\nChat socket closed unexpectedly: 1006\nRun Code Online (Sandbox Code Playgroud)\n我不太确定应该为我的示例提供什么代码,但这是我的消费者的代码和我的设置
\n消费者.py
\nHTTP GET / 200 [0.01, 127.0.0.1:58286]\nHTTP GET /static/chatroom/base.css 304 [0.00, 127.0.0.1:58286]\nHTTP GET /static/chatroom/images/profiles/anonymous.jpg 304 [0.00, …Run Code Online (Sandbox Code Playgroud)