Firefox can’t establish a connection to the server at ws://127.0.0.1:port

I built a chat app that users will be able to call, sending texts and pictures each other.
when i click on call button, I should see my stream and the second user that I am calling to.
I just can see my camera and can not see my contact. if another user tries to call me it will happen the same again. How to fix the problem?

error on console:

 **Firefox can’t establish a connection to the server at ws://127.0.0.1:8000/ws/call/username/**

`# chat/consumers.py

 from channels.generic.websocket import AsyncWebsocketConsumer
 import json

 class ChatConsumer(AsyncWebsocketConsumer):
     async def connect(self):
        self.room_name = self.scope['url_route']['kwargs']['username']
        self.room_group_name = f'chat_{self.room_name}'

    # Join room group
    await self.channel_layer.group_add(
        self.room_group_name,
        self.channel_name
    )

    await self.accept()

async def disconnect(self, close_code):
    # Leave room group
    await self.channel_layer.group_discard(
        self.room_group_name,
        self.channel_name
    )

async def receive(self, text_data):
    # Handle incoming WebSocket messages
    text_data_json = json.loads(text_data)
    message = text_data_json['message']

    # Broadcast message to room group
    await self.channel_layer.group_send(
        self.room_group_name,
        {
            'type': 'chat_message',
            'message': message
        }
    )

async def chat_message(self, event):
    # Send message to WebSocket
    message = event['message']

    # Send message to WebSocket
    await self.send(text_data=json.dumps({
        'message': message
    }))

`

decorators.py

`from functools import wraps
 from django.shortcuts import redirect
 from django.urls import reverse
 from authentication.models import BasicUserProfile
 def basic_user_login_required(view_func):
@wraps(view_func)
def _wrapped_view(request, *args, **kwargs):
    if not request.user.is_authenticated:
        return redirect(reverse('login'))

    
    # Check if the authenticated user has a BasicUserProfile
    if not BasicUserProfile.objects.filter(user=request.user).exists():
        return redirect(reverse('login'))

    return view_func(request, *args, **kwargs)
return _wrapped_view

`

routing.py:

  `# chat/routing.py

   from django.urls import re_path
   from . import consumers

  websocket_urlpatterns = [
      re_path(r'call/<str:username>/', consumers.ChatConsumer.as_asgi()),
       # Define other WebSocket URL patterns as needed
      ]

`

urls.py:
path('call/<str:username>/', views.call_view, name='call'),

views.py:

     `def call_view(request, username):
return render(request, 'chat/call.html', {'username': username})`

templates/
call.html:

       `const roomName = "{{ username }}";
        const callSocket = new WebSocket(`ws://${window.location.host}/ws/call/${roomName}/`);`

I tried to correct routing and consumers and also some elements on front-end side, but no success.