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

849 views
Skip to first unread message

Mike Johnson Jr

unread,
Jun 25, 2017, 4:05:28 PM6/25/17
to Django users

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?

Andrew Godwin

unread,
Jun 27, 2017, 1:42:12 PM6/27/17
to django...@googlegroups.com
I would need to see the full console output of the server, and a full package version listing of what you have installed to help you further.

--
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...@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.

Mike Johnson Jr

unread,
Jun 29, 2017, 10:32:07 AM6/29/17
to Django users
[2017/06/29 09:29:15] [2017/06/29 09:29:20] WebSocket DISCONNECT / [127.0.0.1:36322]
Above is the full console output of the server when I do
ws.connect('ws://localhost:8000')

Package list:
amqp==1.4.9
anyjson
==0.3.3
asgi
-redis==1.4.2
asgiref
==1.1.2
astroid
==1.1.1
attrs
==17.2.0
autobahn
==17.6.1
Automat==0.6.0
awesome
-slugify==1.6.4
backports
.shutil-get-terminal-size==1.0.0
backports
.ssl-match-hostname==3.4.0.2
basicauth
==0.2
bcrypt
==2.0.0
BeautifulSoup==3.2.1
beautifulsoup4
==4.3.2
bidict
==0.1.5
billiard
==3.3.0.23
bing
-search-api==0.1
bleach
==1.4.1
boto
==2.43.0
boto3
==1.4.0
botocore
==1.4.55
bottlenose
==0.6.2
braintree
==3.13.0
btnamespace
==1.1.1
celery
==3.1.23
certifi
==2017.4.17
cffi
==1.7.0
channels
==0.17.3
charade
==1.0.3
chardet
==3.0.4
click
==5.1
collage
==0.1.0
colorama
==0.3.1
commons
==0.7
configparser
==3.5.0
constantly
==15.1.0
coursera
-dl==0.6.1
creole
==1.2
cryptography
==1.4
cv2
==1.0
cvxopt
==1.1.4
Cython==0.23.4
daphne
==1.3.0
decorator
==4.0.10
DistributedLock==1.2
dj
-database-url==0.3.0
dj
-static==0.0.6
dj
-stripe==0.8.0
Django==1.10
django
-ajax-search==1.5.1
django
-allauth==0.25.0
django
-annoying==0.8.3
django
-anymail==0.10
django
-appconf==1.0.2
django
-banish==0.2
django
-block-ip==0.2.0
django
-blog-zinnia==0.15.1
django
-bootstrap-form==3.1
django
-bower==5.0.4
django
-braces==1.8.1
django
-brake==1.5.1
django
-calendarium==1.3.1
django
-celery==3.1.17
django
-classy-tags==0.6.2
django
-cms==3.0.9
django
-common==0.1.51
django
-common-helpers==0.7.0
django
-compressor==1.5
django
-contrib-comments==1.6.1
django
-cors-headers==1.3.1
django
-countries==3.3
django
-crispy-forms==1.4.0
django
-dbarray==0.2
django
-djobberbase==0.1.1
django
-easy-pdf==0.1.0
django
-envelope==1.0
django
-extensions==1.6.1
django
-filer==0.9.12
django
-filter==0.9.1
django
-generic-positions==0.1.7
django
-geoposition==0.2.2
django
-google-maps==0.3.0
django
-groups-manager==0.2.1
django
-guardian==1.2.5
django
-haystack==2.6.1
django
-hvad==1.2.2
django
-imagekit==3.3
django
-imperavi==0.2.3
django
-instagram-api==0.3.7
django
-invitations==1.2
django
-iprestrict==1.3.0
django
-jsonfield==0.9.12
django
-kombu==0.9.4
django
-libs==1.66.3
django
-location-field==1.5.2
django
-m2m-history==0.3.6
django
-markupfield==1.3.5
django
-merchant==0.2
django
-messages==0.5.1
django
-model-utils==2.5
django
-mptt==0.7.4
django
-multimedia==0.2.0
django
-multiselectfield==0.1.4
django
-newsletter==0.6
django
-notification==1.2.0
django
-nyt==0.9.6.post1
django
-payments==0.6.5
django
-paypal==0.2
django
-phonenumber-field==0.7.2
django
-picklefield==0.3.2
django
-pipeline==1.5.4
django
-polymorphic==0.7.1
django
-postgres-copy==0.0.6
django
-precompressed==0.0.2
django
-ratelimit==0.6.0
django
-recaptcha==1.0.3
django
-recommends==0.0.22
django
-registration==1.0
django
-registration-redux==1.1
django
-remote-forms==0.0.1
django
-rest-swagger==0.3.4
django
-reversion==1.8.1
django
-review==1.9.2
django
-reviews==1.1.2
django
-scheduler==0.7.5
django
-sekizai==0.8.2
django
-sendgrid==1.0.1
django
-sendsms==0.2.2
django
-ses==0.8.2
django
-simple-captcha==0.4.6
django
-social-api==0.1.1
django
-social-auth==0.7.28
django
-social-friends-finder==0.2
django
-socketio==0.3.9
django
-sse-wrapper==0.0.4
django
-sslify==0.2.7
django
-storages==1.1.8
django
-storages-redux==1.2.1
django
-subdomains==2.0.4
django
-swingtime==0.6
django
-tagging==0.3.6
django
-taggit==0.18.1
django
-tastypie==0.12.1
django
-templatetag-handlebars==1.3.1
django
-threadedcomments==0.9.0
django
-tinymce==2.6.0
django
-toolbelt==0.0.1
django
-user-accounts==1.2.0
django
-user-media==1.1.6
django
-vote==2.1.4
django
-watson==1.3.1
django
-webtest==1.7.8
django
-wmd-editor==0.9.0
django
-wysiwyg==0.7.1
django
-xmlrpc==0.1.5
djangocms
-admin-style==0.2.5
djangorestframework
==3.3.0
djorm
-pgarray==1.2
djrill
==1.3.0
docutils
==0.12
easy
-thumbnails==2.2
ecdsa
==0.13
entrypoints
==0.2.2
enum34
==1.1.6
eventlog
==0.8.0
Facebook==0.0
facebook
-sdk==0.4.0
facepy
==1.0.6
factory
-boy==2.5.2
fandjango
==4.2
feedparser
==5.1.3
ffmpy
==0.1.0
fudge
==1.0.3
functools32
==3.2.3.post2
future
==0.14.3
futures
==3.0.3
gdata
==2.0.18
geocoder
==1.6.4
geopy
==1.11.0
gevent
==1.0.2
gevent
-socketio==0.2.1
gevent
-websocket==0.9.5
google
-api-python-client==1.4.2
graphviz
==0.3.4
greenlet
==0.4.9
gunicorn
==19.1.1
html5lib
==1.0b10
htmlentities
==0.2.1
httplib2
==0.9.2
humanize
==0.5.1
hyperlink
==17.2.1
icalendar
==3.9.0
idna
==2.5
imageio
==1.5
importlib
==1.0.3
incremental
==17.5.0
inflection
==0.3.1
ipaddress
==1.0.16
ipcalc
==1.99.0
ipykernel
==4.3.1
ipython
==4.2.0
ipython
-genutils==0.1.0
ipywidgets
==5.1.5
jdcal
==1.0
Jinja2==2.7.3
jmespath
==0.9.0
jobtastic
==0.3.1
jsonfield
==2.0.0
jsonpickle
==0.8.0
jsonschema
==2.5.1
jupyter
==1.0.0
jupyter
-client==4.3.0
jupyter
-console==4.1.1
jupyter
-core==4.1.0
kaleo
==1.5
keyring
==9.3.1
kombu
==3.0.35
Lasagne==0.1
ldif3
==3.1.1
librabbitmq
==1.6.1
limnoria
==2015.3.10
logilab
-common==0.61.0
lxml
==3.4.4
Markdown==2.6
markdown2
==2.3.0
markup
==0.2
MarkupSafe==0.23
matplotlib
==1.1.1
-e git://github.com/dreikanter/markdown-grid@497037afac7710a85979edea944827673750
gg
=mdx_grid
mega
.py==0.9.18
metron
==1.3.1
Mezzanine==3.1.10
mistune
==0.7.2
mixpanel
==4.1.0
mock
==1.0.1
more
-itertools==2.2
mots
-vides==2015.5.11
moviepy
==0.2.2.11
mpmath
==0.19
mps
==0.20.8
msgpack
-python==0.4.8
mysql
-python==1.2.5
nbconvert
==4.2.0
nbformat
==4.0.1
ndg
-httpsclient==0.4.2
networkx
==1.9
nltk
==3.0.4
nose
==1.3.7
notebook
==4.2.1
numpy
==1.11.1
oauth2
==1.5.211
oauth2client
==1.5.2
oauthlib
==2.0.2
openpyxl
==2.0.5
pafy
==0.5.2
pandas
==0.18.1
pathlib2
==2.1.0
phonenumbers
==7.0.7
php
==1.0
pickleshare
==0.7.2
pika
==0.10.0
pilkit
==1.1.13
Pillow==2.3.0
pinax
-stripe==3.2.1
pinax
-teams==0.1.1
pinax
-theme-bootstrap==5.4.0
pinax
-wiki==0.1.1
pinder
==1.0.1
pkginfo
==1.2.1
portalocker
==0.5.7
praw
==4.5.1
prawcore
==0.10.1
psutil
==3.4.2
psycopg2
==2.5.4
pyasn1
==0.1.9
pyasn1
-modules==0.0.8
pycosat
==0.6.1
pycparser
==2.14
pycrypto
==2.6.1
pydot
==1.0.2
pyenchant
==1.6.8
PyExecJS==1.1.0
pygame
==1.9.1
Pygments==2.1.3
PyJWT==0.4.1
pylint
==1.2.1
pylint
-django==0.3
pylint
-plugin-utils==0.1.1
pymedia
==1.3.7.3
pyOpenSSL
==16.0.0
pyparsing
==2.0.3
pypiwin32
==219
PyReact==0.5.2
pyreadline
==2.0
pyshp
==1.2.3
python
-amazon-simple-product-api==1.5.0
python
-card-me==0.9.3
python
-dateutil==2.5.3
python
-distutils-extra==2.28
python
-gnupg==0.3.7
python
-instagram==1.3.0
python
-mega==0.1.0
python
-memcached==1.57
python
-mimeparse==0.1.4
python
-oauth2==0.7.0
python
-omgeo==1.7.2
python
-openid==2.2.5
python
-social-auth==0.2.1
python
-twitter==3.3
pytube
==6.1.11
pytz
==2017.2
pywin32
-ctypes==0.0.1
PyYAML==3.11
pyzmq
==14.7.0
qtconsole
==4.2.1
Quandl==3.0.1
ratelim
==0.1.6
ratelimit
==0.0.1
redis
==2.10.5
regex
==2015.5.10
requests
==2.17.3
requests
-oauthlib==0.8.0
requests
-toolbelt==0.7.0
rsa
==3.3
s3transfer
==0.1.4
scikit
-learn==0.13
scipy
==0.11.0
simplegeneric
==0.8.1
simplejson
==3.6.5
six
==1.10.0
SocksiPy-branch==1.1
sorl
-thumbnail==12.2
sphinx
-me==0.3
SQLAlchemy==0.9.9
sse
==1.2
static==0.4
static3
==0.5.1
statsmodels
==0.4.3
stevedore
==1.0.0
stripe
==1.22.2
suds
==0.4
suds
-jurko==0.6
supybot
==0.83.4.1
surlex
==0.2.0
sympy
==1.0
textile
==2.2.2
Theano==0.8.2
tinys3
==0.1.11
tivix
-django-braintree==0.1.3
tornado
==4.2
tqdm
==4.7.4
traitlets
==4.2.1
twine
==1.4.0
Twisted==17.5.0
txaio
==2.8.0
typing
==3.6.1
uncompyle2
==1.1
unicode
-slugify==0.1.1
unicodecsv
==0.14.1
Unidecode==0.4.17
unpyclib
==0.8.1
update
-checker==0.16
uritemplate
==0.6
urllib3
==1.21.1
URLObject==2.4.0
utils
==0.7
virtualenv
==13.1.0
virtualenv
-clone==0.2.5
virtualenvwrapper
==4.3.1
waitress
==0.8.10
Watson==0.1.5
web
.py==0.37
webencodings
==0.5
WebOb==1.5.1
websocket
-client==0.43.0
WebTest==2.0.20
whitenoise
==3.2.2
Whoosh==2.7.4
widgetsnbextension
==1.2.3
wiki
==0.0.24.2
wiki
-cb==0.14.0.1
wiki
-markdown==1.0
wikipedia
==1.1
wokkel
==0.7.0
xapian
-haystack==2.1.0
xlrd
==0.9.3
xlutils
==1.7.0
xlwt
==0.7.5
xmltodict
==0.10.2
youtube
-dl==2016.7.22
zope
.interface==4.1.3

Thank you for your help
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.

Mike Johnson Jr

unread,
Jun 29, 2017, 10:33:24 AM6/29/17
to Django users
oops, full package list is actually:

Reply all
Reply to author
Forward
0 new messages