django channels:WebSocket在建立连接之前关闭

时间:2017-09-21 12:49:38

标签: django websocket django-channels

我是django频道的新手。我阅读this tutorial来创建实时聊天应用程序,但我有这个错误

Chrome中的

WebSocket connection to 'ws://127.0.0.1:8000/chat/stream/' failed: WebSocket is closed before the connection is established.

Firefox中的

Firefox can't establish a connection to the server at ws://127.0.0.1:8001/chat/stream/.

The connection to ws://127.0.0.1:8001/chat/stream/ was interrupted while the page was loading.

请帮帮我。非常感谢。

1 个答案:

答案 0 :(得分:0)

您可能会在代码中遗漏这个:

message.reply_channel.send({"accept": True})
ws_connect

中的