Sunday, June 25, 2017

Websocket, an existing connection was forcibly closed by the remote host. django-channels

So I'm getting the error as described in the title of this post.

I'm following this tutorial: https://gearheart.io/blog/creating-a-chat-with-django-channels/

Here's the full traceback:

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

I have redis running, manage.py runserver running, and I'm using django-channels. This is my first time working with websockets. Can anyone help out and let me know what's wrong?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/878e70cd-4e39-4b1f-87bd-da7ddb03605b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment