Skip to content Skip to sidebar Skip to footer

Django Chat App: WebSocket Connection To Wss://... Failed

I have an instant chat app working successfully on my localhost, but after deploying to Heroku I got an error because I was using ws instead of wss. I changed that in room.html bel

Solution 1:

If you use wss, your host must be https.

If you set Debug=False, you should use daphne;

pip install daphne

pip install -U Twisted[tls,http2]

sudo vim /etc/systemd/system/daphne.service

[Unit]
Description=daphne daemon
After=network.target

[Service]
User=centos
Group=nginx
WorkingDirectory=/var/www/project_path
ExecStart=/path/daphne -u /project_path/tmp/channels.sock project_name.asgi:application

[Install]
WantedBy=multi-user.target

Post a Comment for "Django Chat App: WebSocket Connection To Wss://... Failed"