Answer the question
In order to leave comments, you need to log in
Why is antivirus (windows firewall) blocking ajax connection?
this script is located on the device connected to the LAN.
When loading the web interface, the device is polled to update the data with an interval of 1000 ms. Everything works great. Further, when sending a request (wr_com=eraslog), the timer stops (stop_update), because - the device after this request is not available for 30 seconds. for sending and receiving data. After 30 seconds, it starts again (start_update). And here the problem begins: communication with the device is interrupted for 2-3 minutes. (When the antivirus is disabled, the connection is not interrupted, everything is OK), then it is restored.
Question: what should be written in the request (headers) so that the antivirus does not block the connection to the device? And what settings should be on the server side?
var start_update = function(){ //запуск обновления данных
window.timerId = window.setInterval( update_change, 1000);
};
var stop_update = function() { // остановка обновления данных
window.clearInterval(window.timerId);
window.timerId = undefined;
};
function update_change(){ // функция обновления данных
//
$.ajax({
type: 'get',
url: 'change.json'
})
.done(function(data) {
//обновляем данные
})
}
$(document).on('click', 'button', function(){
$.ajax({
url: 'com.json',
data: 'wr_com=eraslog',
beforeSend: function(xhr, settings) {
stop_update();
var timeval = 30,
timerDelLog = setInterval(function () {
if(timeval <= 0) {
clearInterval(timerDelLog);
start_update();
}
}, 1000);
}
})
});
Answer the question
In order to leave comments, you need to log in
what should be written in the request (headers) so that the antivirus does not block the connection to the device
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question