0.0.117
This commit is contained in:
@@ -43,11 +43,19 @@ chatSocket.onmessage = function (e) {
|
||||
// console.log("open")
|
||||
// }
|
||||
|
||||
chatSocket.onopen = function(){
|
||||
console.log("open")
|
||||
}
|
||||
|
||||
chatSocket.onclose = function () {
|
||||
console.log("close")
|
||||
}
|
||||
|
||||
chatSocket.onopen = function(){
|
||||
console.log("open")
|
||||
chatSocket.send('A');
|
||||
}
|
||||
function sendMessageSocket (data) {
|
||||
//
|
||||
|
||||
chatSocket.send(JSON.stringify(data))
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
// // check_new_messages_timeout(60000,it_set_func,it_func)
|
||||
// // }
|
||||
//
|
||||
// function check_new_messages_timeout(timeout_time=short_timeout){
|
||||
function check_new_messages_timeout(timeout_time=1000){
|
||||
// if (check_msg){
|
||||
// clearInterval(check_msg)
|
||||
// }
|
||||
@@ -77,7 +77,7 @@
|
||||
//
|
||||
// },
|
||||
// timeout_time)
|
||||
// }
|
||||
}
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
@@ -225,29 +225,30 @@ function sendMessage(id_ticket=null,sender,receiver){
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
url: '/ru/messages/send_msg/',
|
||||
type: "POST",
|
||||
// async: true,
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
// enctype: 'json',
|
||||
data: JSON.stringify(data),
|
||||
success: function(data){
|
||||
getNewMessageSession()
|
||||
|
||||
document.querySelector(".container-messages").innerHTML = data.html;
|
||||
document.querySelector(".enter-message-inp").focus()
|
||||
|
||||
},
|
||||
error: function (data){
|
||||
|
||||
document.querySelector(".container-messages").innerHTML = data.responseJSON.error;
|
||||
document.querySelector(".enter-message-inp").focus()
|
||||
}
|
||||
});
|
||||
// $.ajax({
|
||||
// headers: { "X-CSRFToken": $('input[name=csrfmiddlewaretoken]').val() },
|
||||
// url: '/ru/messages/send_msg/',
|
||||
// type: "POST",
|
||||
// // async: true,
|
||||
// cache: false,
|
||||
// processData: false,
|
||||
// contentType: false,
|
||||
// // enctype: 'json',
|
||||
// data: JSON.stringify(data),
|
||||
// success: function(data){
|
||||
// getNewMessageSession()
|
||||
//
|
||||
// document.querySelector(".container-messages").innerHTML = data.html;
|
||||
// document.querySelector(".enter-message-inp").focus()
|
||||
//
|
||||
// },
|
||||
// error: function (data){
|
||||
//
|
||||
// document.querySelector(".container-messages").innerHTML = data.responseJSON.error;
|
||||
// document.querySelector(".enter-message-inp").focus()
|
||||
// }
|
||||
// });
|
||||
sendMessageSocket(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user