homelog/homelog/routing.py

16 lines
583 B
Python

from channels.routing import ProtocolTypeRouter, URLRouter
from channels.auth import AuthMiddlewareStack
from django.urls import path, re_path
from booker.booker_fe_consumer import BookerFeConsumer
from booker.scanner_announce_consumer import ScannerAnnounceConsumer
from django.core.asgi import get_asgi_application
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'homelog.settings')
websocket_urlpatterns = [
re_path(r'ws/scanner/(?P<scanner_id>[\w-]+)/$', BookerFeConsumer.as_asgi()),
re_path(r'ws/scanner-announce/$', ScannerAnnounceConsumer().as_asgi()),
]