AttributeError: type object 'ChatConsumer' has no attribute 'as_asgi()

Viewed 4529
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
        re_path(r'ws/chat/(?P<room_name>\w+)/$',consumers.ChatConsumer.as_asgi()),]

getting error of as_asgi()

2 Answers

This is because of the version of 'channels'. check the channels version of your channels. It is working with channels 3.0.1. If you had downgraded your channels-redis, channels also will get downgraded.

Use channels==3.0.1 & you are good to go.

Related