diff options
| author | 2026-07-01 21:32:07 +0200 | |
|---|---|---|
| committer | 2026-07-01 21:32:07 +0200 | |
| commit | 9c4e4ab4c3504710efd8483c1e27692301afb940 (patch) | |
| tree | 9b24182db9362220b39aee4e79857a35b7fde3e7 | |
| parent | a188df3ae359ab770aac85d19d23739286ef6d41 (diff) | |
| download | websocket-chat-9c4e4ab4c3504710efd8483c1e27692301afb940.tar.gz websocket-chat-9c4e4ab4c3504710efd8483c1e27692301afb940.tar.bz2 websocket-chat-9c4e4ab4c3504710efd8483c1e27692301afb940.zip | |
Fixed issuesmain
| -rw-r--r-- | chat/routing.py | 4 | ||||
| -rw-r--r-- | chat/templates/room.html | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/chat/routing.py b/chat/routing.py index 9f08ddf..0de511e 100644 --- a/chat/routing.py +++ b/chat/routing.py | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | from django.urls import re_path | 1 | from django.urls import re_path, path |
| 2 | 2 | ||
| 3 | from . import consumers | 3 | from . import consumers |
| 4 | 4 | ||
| 5 | websocket_urlpatterns = [ | 5 | websocket_urlpatterns = [ |
| 6 | re_path(r"ws/chat/(?P<room_name>\w+)/$", consumers.ChatConsumer.as_asgi()), | 6 | path("ws/chat/<str:room_name>/", consumers.ChatConsumer.as_asgi()), |
| 7 | ] | 7 | ] |
diff --git a/chat/templates/room.html b/chat/templates/room.html index de76f67..502b7c8 100644 --- a/chat/templates/room.html +++ b/chat/templates/room.html | |||
| @@ -391,9 +391,7 @@ | |||
| 391 | } | 391 | } |
| 392 | 392 | ||
| 393 | const chatSocket = new WebSocket( | 393 | const chatSocket = new WebSocket( |
| 394 | 'ws://' | 394 | '/ws/chat/' |
| 395 | + window.location.host | ||
| 396 | + '/ws/chat/' | ||
| 397 | + roomName | 395 | + roomName |
| 398 | + '/' | 396 | + '/' |
| 399 | + '?token=123' | 397 | + '?token=123' |
