django / daphne

Django Channels HTTP/WebSocket server
BSD 3-Clause "New" or "Revised" License
2.37k stars 266 forks source link

Daphne with self signed ssl #494

Closed HannanMalik007 closed 9 months ago

HannanMalik007 commented 9 months ago

I am running daphne with command daphne -e ssl:8001:privateKey=private_key.pem:certKey=certificate.pem ScrapTaxi.asgi:application -p 8001 -b 192.168.100.58 i am making connection with wss but unable to connect error: Client network socket disconnected before secure TLS connection was established i am able to connect with ws.

This is my asgi.py file.

import os

import os, django

from django.core.asgi import get_asgi_application from channels.routing import get_default_application django_asgi_app = get_asgi_application()

from django.core.asgi import get_asgi_application

from channels.routing import ProtocolTypeRouter, URLRouter

from channels.auth import AuthMiddlewareStack from django.urls import path from scraptaxiapp.consumers import UploadFileConsumer from scraptaxiapp.routing import websocket_urlpatterns

print("websockets", websocket_urlpatterns, URLRouter(websocket_urlpatterns)) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ScrapTaxi.settings") django.setup() application = ProtocolTypeRouter({ 'https': django_asgi_app, 'websocket': AuthMiddlewareStack(URLRouter(websocket_urlpatterns)) }) using daphne 4.0.0

carltongibson commented 9 months ago

Sorry, there's not enough detail to help you with here, or show an issue with Daphne. Likely it's your web server configuration, but impossible to say. (That's not something I can help you with here I'm afraid.)

HannanMalik007 commented 8 months ago

@carltongibson which detail you need? i can share here.