0.0.165
This commit is contained in:
5
static/js/filters_functions_find_route.js
Normal file
5
static/js/filters_functions_find_route.js
Normal file
@@ -0,0 +1,5 @@
|
||||
function filters_func_find_route_main (){
|
||||
let urls_for_els = {
|
||||
'road_url':''
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
$(document).ready(function (){
|
||||
getNewMessageSession()
|
||||
})
|
||||
// $(document).ready(function (){
|
||||
// getNewMessageSession()
|
||||
// })
|
||||
|
||||
// window.onfocus = function () {
|
||||
// getSocketState()
|
||||
// }
|
||||
|
||||
function getNewMessageSession(){
|
||||
|
||||
// let window_messages = document.querySelector(".container-messages")
|
||||
// let new_timeout_time;
|
||||
// if (window_messages !== null){
|
||||
@@ -17,6 +22,36 @@ function getNewMessageSession(){
|
||||
// check_new_messages_timeout(new_timeout_time)
|
||||
}
|
||||
|
||||
// function getSocketState () {
|
||||
chatSocket.onclose = function (){
|
||||
console.log("closed")
|
||||
setTimeout(onopen_ws,1000)
|
||||
|
||||
}
|
||||
function onopen_ws (){
|
||||
let sw_int = setInterval(function (){
|
||||
if (chatSocket.readyState > 1){
|
||||
chatSocket = new WebSocket(ws_url)
|
||||
// chatSocket.onopen = function (){
|
||||
} else if (chatSocket.readyState === 1){
|
||||
clearInterval(sw_int)
|
||||
} else {
|
||||
console.log("connecting...")
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
},1000)
|
||||
}
|
||||
|
||||
chatSocket.onopen = function (){
|
||||
console.log("open")
|
||||
}
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// var window_messages = document.querySelector(".container-messages")
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
{#var user_id = {{ user.id }}#}
|
||||
ws_url = `ws://{% get_ws_address %}/ws/socket-server/?user_id={{ user.id }}`;
|
||||
const chatSocket = new WebSocket(ws_url);
|
||||
let chatSocket = new WebSocket(ws_url);
|
||||
const beep = new Audio('/static/sounds/beep_2.mp3')
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user