Spaces:
Sleeping
Sleeping
| # ============================================ | |
| # educonnect_api/routing.py - WebSockets (Channels) | |
| # ============================================ | |
| from channels.routing import ProtocolTypeRouter, URLRouter | |
| from channels.auth import AuthMiddlewareStack | |
| from django.urls import path | |
| from apps.messaging.consumers import ChatConsumer | |
| websocket_urlpatterns = [ | |
| path('ws/chat/<int:conversation_id>/', ChatConsumer.as_asgi()), | |
| ] | |
| application = ProtocolTypeRouter({ | |
| 'websocket': AuthMiddlewareStack( | |
| URLRouter(websocket_urlpatterns) | |
| ), | |
| }) | |