[Answered ]-How to connect flutter Web_socket_channel package with Django Channels?

1👍

you don’t need JS code and html template.
you should change your flutter code like this if you are using local host to run your server:

final channel = IOWebSocketChannel.connect('ws://127.0.0.1:8000/ws/chat/hello/');

dont forget to change your ALLOWED_HOSTS in settings.py in your django project. you can change it like this:

ALLOWED_HOSTS = ['*']

if 127.0.0.1 doesnt work use 10.0.2.2 instead of that

Leave a comment