This commit is contained in:
2023-08-13 14:42:52 +03:00
parent eb0c143166
commit 2dd03e4d2f
3 changed files with 12 additions and 10 deletions

View File

@@ -39,14 +39,13 @@
// }
// }
// var i = 0
window.onload = function (){
let user_id = document.querySelector(".button_profile_header").dataset['userId']
let url = `ws://localhost:8000/ws/socket-server/?user_id=${user_id}`;
const chatSocket = new WebSocket(url);
}
url = `ws://localhost:8000/ws/socket-server/?user_id=${user_id}`;
const chatSocket = new WebSocket(url);
function sendMessageSocket (data) {
chatSocket.send(JSON.stringify(data));
}
@@ -103,5 +102,4 @@ chatSocket.onmessage = function (e) {
// // btn.reset()
// })
// }
// let form = document.getElementById('form')
// let form = document.getElementById('form')

View File

@@ -8,12 +8,11 @@
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet">
<script src='{% static "js/user_profile.js" %}'> </script>
<script src='{% static "js/user_profile(boris).js" %}'> </script>
<script src='{% static "js/check_new_messages.js" %}'></script>
{# <script src='{% static "js/chat_sockets.js" %}'></script>#}
<link rel="stylesheet" href="{% static 'css/ion.rangeSlider.min.css' %}">
<script defer src='{% static "js/check_new_messages.js" %}'></script>
@@ -21,5 +20,6 @@
{% block content %}
{% include 'blocks/b_user_profile.html' %}
{% endblock %}

View File

@@ -7,6 +7,10 @@
<script src='{% static "js/jquery_v3_6_4.js" %}'> </script>
<script>
var user_id = {{ user.id }}
</script>
<script src='{% static "js/chat_sockets.js" %}'></script>