Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Websocket,python-远程主机(django通道)强制关闭了现有连接_Python_Django_Websocket_Redis_Django Channels - Fatal编程技术网

Websocket,python-远程主机(django通道)强制关闭了现有连接

Websocket,python-远程主机(django通道)强制关闭了现有连接,python,django,websocket,redis,django-channels,Python,Django,Websocket,Redis,Django Channels,所以我得到了这个错误,正如这篇文章的标题所描述的。以下是完整的回溯: In [1]: import websocket In [2]: ws = websocket.WebSocket() In [3]: ws.connect("ws://localhost:8000") --------------------------------------------------------------------------- error

所以我得到了这个错误,正如这篇文章的标题所描述的。以下是完整的回溯:

In [1]: import websocket

In [2]: ws = websocket.WebSocket()

In [3]: ws.connect("ws://localhost:8000")
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-3-43b98f503495> in <module>()
----> 1 ws.connect("ws://localhost:8000")

c:\Python27\lib\site-packages\websocket\_core.pyc in connect(self, url, **options)
    212
    213         try:
--> 214             self.handshake_response = handshake(self.sock, *addrs, **options)
    215             self.connected = True
    216         except:

c:\Python27\lib\site-packages\websocket\_handshake.pyc in handshake(sock, hostname, por
t, resource, **options)
     67     dump("request header", header_str)
     68
---> 69     status, resp = _get_resp_headers(sock)
     70     success, subproto = _validate(resp, key, options.get("subprotocols"))
     71     if not success:

c:\Python27\lib\site-packages\websocket\_handshake.pyc in _get_resp_headers(sock, succe
ss_status)
    125
    126 def _get_resp_headers(sock, success_status=101):
--> 127     status, resp_headers = read_headers(sock)
    128     if status != success_status:
    129         raise WebSocketBadStatusException("Handshake status %d", status)

c:\Python27\lib\site-packages\websocket\_http.pyc in read_headers(sock)
    224
    225     while True:
--> 226         line = recv_line(sock)
    227         line = line.decode('utf-8').strip()
    228         if not line:

c:\Python27\lib\site-packages\websocket\_socket.pyc in recv_line(sock)
     99     line = []
    100     while True:
--> 101         c = recv(sock, 1)
    102         line.append(c)
    103         if c == six.b("\n"):

c:\Python27\lib\site-packages\websocket\_socket.pyc in recv(sock, bufsize)
     78
     79     try:
---> 80         bytes_ = sock.recv(bufsize)
     81     except socket.timeout as e:
     82         message = extract_err_message(e)

error: [Errno 10054] An existing connection was forcibly closed by the remote host
[1]中的
:导入websocket
在[2]中:ws=websocket.websocket()
在[3]中:ws.connect(“ws://localhost:8000”)
---------------------------------------------------------------------------
错误回溯(最近一次呼叫上次)
在()
---->1 ws.connect(“ws://localhost:8000”)
c:\Python27\lib\site packages\websocket\\u core.pyc in connect(self,url,**选项)
212
213尝试:
-->214 self.handshake\u response=握手(self.sock,*地址,**选项)
215 self.connected=True
216除:
c:\Python27\lib\site packages\websocket\\握手中的handshake.pyc(sock、主机名、por
t、 资源,**选项)
67转储(“请求头”,头\u str)
68
--->69状态,resp=\u获取\u resp\u头(sock)
70成功,subtoto=\u验证(resp,key,options.get(“subtocols”))
71如果不成功:
c:\Python27\lib\site packages\websocket\\u handshake.pyc in\u get\u resp\u headers(sock,succe
党卫军(地位)
125
126 def_get_resp_头文件(sock,success_status=101):
-->127状态,响应头=读取头(sock)
128如果状态!=成功状态:
129引发WebSocketBadStatusException(“握手状态%d”,状态)
c:\Python27\lib\site packages\websocket\\读取头中的http.pyc(sock)
224
225尽管如此:
-->226线=接收线(短袜)
227行=行.decode('utf-8').strip()
228如果不是第行:
c:\Python27\lib\site packages\websocket\\u socket.pyc在recv_行(sock)中
99行=[]
100虽然正确:
-->101 c=recv(袜子,1)
102行。追加(c)
103如果c==6.b(“\n”):
recv中的c:\Python27\lib\site packages\websocket\\u socket.pyc(sock,bufsize)
78
79尝试:
--->80字节=sock.recv(bufsize)
81套接字除外。超时为e:
82消息=提取错误消息(e)
错误:[Errno 10054]远程主机已强制关闭现有连接
我让redis运行,
manage.py runserver
运行,我使用的是django频道。这是我第一次使用WebSocket。有谁能帮我一下,告诉我出了什么事吗