I am following this tutorial
<https://gearheart.io/blog/creating-a-chat-with-django-channels/> to learn
django channels.
The following procedure was used :
- Add the following code in settings.py
redis_host=os.environ.get('REDIS_HOST','localhost')
CHANNEL_LAYERS={
"default":{
"BACKEND":"asgi_redis.RedisChannelLayer",
"CONFIG":{
"hosts":[(redis_host),6379],
},
"ROUTING":'channelproj.routing.channel_routing',
},
}
- Create a file routing.py and add the following code
from channels import route
# This function will display all messages received in the console
def message_handler(message):
print(message['text'])
channel_routing = [
route("websocket.receive", message_handler),
]
- run server using python manage.py runserver and then try to connect to
server using ws.connect("ws://localhost:8000/")
I am getting the following error
websocket._exceptions.WebSocketBadStatusException: Handshake status 200
What can be the reason for this error and how can it be rectified?
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/d560ebbb-242c-4481-b688-42e2d65c112a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.