P
P
Pavel2021-04-13 12:30:34
AJAX
Pavel, 2021-04-13 12:30:34

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

1 answer(s)
D
Dimonchik, 2021-04-13
@dimonchik2013

what should be written in the request (headers) so that the antivirus does not block the connection to the device

write down everything you need to do it right
, please, slowly learn to state the facts, this will help a lot in life, first of all, you - rose-colored glasses and all that, otherwise there is a lot of text, even code (haha), and the facts are zero
facts are :
here is the log (well, let's say a postman or a fiddler)
here in the normal state
, but in the abnormal state
it is obvious that
[here are my conclusions]
but if so
[here the actions taken with other urls, with the antivirus disabled, etc.]
then the log such a
>>>>> and here the answer is often found without a community: it is enough just to state the facts <<<<

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question