Reputation: 333
I have my Django application deployed on heroku. It uses websockets, and everything is configured properly. When I go to my site, the websockets fail with WebSocket connection to 'wss://<url>' failed: Error during WebSocket handshake: Unexpected response code: 404
. I did some digging and it's apparently due to chrome blocking the websockets? I came across this issue which sounds like what I'm getting, but the answer did not fix it for me.
Can someone explain what's going on here, and potentially how to fix it?
Upvotes: 1
Views: 797
Reputation: 333
So the solution was nothing to do with heroku. I was using gunicorn to deploy my application, and that does not support websockets, so when the website hit my websocket endpoint gunicorn threw back a 404. I switched to daphne, and added web: daphne <application>.asgi:application --port $PORT --bind 0.0.0.0
to the Procfile, and everything started working. This blog post from Heroku helped me out, most specifically This segment.
Upvotes: 2
Reputation: 182
try using https://<url>
inspite of using wss
i came across the same issue when i deployed my node.js application on heroku.
hope this will solve your problem too.
Upvotes: 0