jquery - What is the difference between long and regular polling? -


Here, every 30 seconds , I make an AJAX call to update my DB I am

  setInterval (function () {$ .ajax ({url: "server", success: function (data) {// update your dashboard gauge salegadget.Setview (data.value); }, Data type: "Jason"});}, 30000);   

Another question - if the server takes more than 30 seconds to give a negative feedback, what will be the negative side? Call sends another request to # 1, while Call # 1 is being updated - updating DB in latest value.

long polling

  (function survey () {$ .ajax ({Url: "server", success: function (data) {// your dashboard gauge sales update PleaseGuage.setview (data.value);}, datatype: "Jason", complete: selection, timeout: 30000});}) ();   

The AJAX call is sent, invites itself every 30 seconds, and once the call is completed it calls itself again, whereas it looks more synchronous, What if we send a call, at the end of 30 seconds (when I'm waiting to come back for the first time)?

We now have the same "problem" that we had for the first time. Points in points of speech because I am waiting for a response from a former, because I do not really see any problems with sending an AJAX request

Thank you! Tell me that this question was not clear.

main problem:

  setInterval (function () {$ Ajax ({url: "server", success: function (data) {// update your dashboard gauge cellsgadget.setValue (data.value);}, datatype: "json"});}, 30000);   

It is that you are not set timed out on AJAX requests yourself. It leaves it undefined, and as you can make a build-up, five requests are waiting for all the servers to respond and add every 30 seconds. This is not ideal because:

  • If the server is taking feedback for more than 30 seconds, then you are adding more requests to launch and load. It is not so important on the small scale app, but when you have 1000 users, it actually gets stacked.
  • If the server wakes up after 120 seconds, you will get four responses at the same time

    set interval (even if it is incomplete with jQuery's full callback ,) Is not particularly wrong, but you need to set a timeout.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -