4
votes

I have made an app of Django Channels and its working perfect locally,but when I deployed it to production (Google Cloud Platform) it's giving me:

(index):42 WebSocket connection to 'wss://appname-263701.appspot.com/ws/chat/user2/' failed: Error during WebSocket handshake: Unexpected response code: 400

I can't figure whats the problem is, is it a problem of WSS? The app is working fine locally.

If need some code to review I can also upload that! Just need a guide how I can fix this

1
If you're using a Google Load Balancer, I had to tweak some settings there to make it work with django-channels. - yrekkehs
No I am not using Google Load Balancer - Nabeel Ayub
Are you using App Engine Standard Environment? - Nibrass H

1 Answers

4
votes

I think you are using Standard App Engine Environment, and WebSockets are only supported in the Flexible Environment for App Engine. So, I would suggest you to change the environment from Standard to Flexible, see here for the app.yaml Configuration File in Flex. This way, you will be able to use WebSockets functionality implemented on App Engine.