[Answered ]-How can I fix the error of not being able to establish a connection to a Django Channels server with WebSockets using Python and ASGI?

1👍

The problem was in routing.py :

websocket_urlpatterns = [
    url(r'^ws/room/(?P<room_code>\w+)/$', DrawConsumer.as_asgi()),
]

the correct version is :

websocket_urlpatterns = [
    path('ws/room/<room_code>/', DrawConsumer.as_asgi()),
]
👤antaww

Leave a comment