I have a websocket connection in my django project using daphne and channels like this: asgi.py file
os.environ.setdefault(‘DJANGO_SETTINGS_MODULE’, ‘MeseroVirtual.settings’)
#application = get_asgi_application()
application = ProtocolTypeRouter({
“https”: get_asgi_application(),
‘websocket’: AuthMiddlewareStack(
URLRouter(
MeseroVirtual.routing.websocket_urlpatterns
))
})
routing.py file:
websocket_urlpatterns = [
re_path(r’wss/socket-server/', OrderConsumer.as_asgi()),
]
and so I invoke it:
let url = wss://${window.location.host}/wss/socket-server/
console.log(url)
const socket = new WebSocket(url)
Locally it works fine but already in production in RENDER this error appears:
administrador/:611 WebSocket connection to ‘wss://proyecto-mesero-ubuntu.onrender.com/wss/socket-server/’ failed: