Frontend web socket request not working

Hello. I’m fairly new to render. I deployed my frontend yesterday as a static service. Before I deployed my frontend, I deployed my backend and my web socket connection made from my frontend vanilla js script worked fine with

const socket = new WebSocket(“wss://sensorfusionbackend.onrender.com/ws/data”)

But when I hosted my frontend, and updated my Django backend settings to include the new domain name in my CORS configuration, it refused to work. The connection is refusing to be made. I inspected the page and saw that the error in the console was that the connection failed.

I have tried to change the connection settings from “ws/data/“ to “wss/data/“ it still didn’t work. Nothing I’m doing is working.

Is there a problem with render and the static site settings? Should I have hosted the frontend as a web service instead? Please I need assistance

Hi there,

Hmm, browsers do not enforce any CORS policies from web socket connections, so I’m unsure how changing any CORS settings would cause this. Without knowing more about your service, it is kind of hard to answer the question. Can you please use our dashboard to open a ticket directly with us.

Regards,

Keith
Render Support, UTC+10 :australia: