server accepts websocket connection
This commit is contained in:
@ -9,8 +9,17 @@ https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
|
||||
|
||||
import os
|
||||
|
||||
from channels.routing import ProtocolTypeRouter, URLRouter
|
||||
from django.urls import path
|
||||
from django.core.asgi import get_asgi_application
|
||||
|
||||
from .websocket import WebsocketHandler
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'server.settings')
|
||||
|
||||
application = get_asgi_application()
|
||||
django = get_asgi_application()
|
||||
|
||||
application = ProtocolTypeRouter({
|
||||
"http": django,
|
||||
"websocket":URLRouter({path("ws",WebsocketHandler.as_asgi())})
|
||||
})
|
||||
|
Reference in New Issue
Block a user