I am writing one simple web page with a bunch of text fields and a control button. Now that the user has finished editing the values ββin these text fields, the user must click a button, and this button calls an intensive algorithm with an intensive process on the server side based on data received from the client (text fields)
And it may take up to 30-45 minutes to complete the whole operation, so the current thread is still inside the function of the button click event handler.
This background task provides only one event, and the web page subscribes to it to receive some textual data after each processing step.
I wandered if there is any way so that I can constantly update information about what is the current progress in this background task. I have a div element to print current status information
So, I am looking for some kind of reverse mechanism, then "get" and "post".
I have read several articles on comets (programming), but I cannot find an easy or definitive answer
Thank you in advance
Perhaps the easiest way is to send the job and return the identifier via a direct POST message. This identifier corresponds to long server-side operation.
HTTP, .. . () 30 .
, . , /. , 30/45 , .
"Comet" (aka Ajax-Push reverse-Ajax). , "" - , , . Ajax , , , , ( webapp, ..). , StackOverflow , , .
, , , , , id , . , ajax , , , , , Ajax . , ajax div , .
, . , , , , . - , 30-45 , . , , , , , - (, ).
:
Take a look at three examples of both methods based on ItsNat framework:
Sorry, this is Java.
Source: https://habr.com/ru/post/1717866/More articles:The disappearance of WindowsForm - c #ASP.Net MVC and Windows 7 404 error - asp.net-mvcHow to convert double to string using only math.h? - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1717864/porting-shell-functions-to-cmdexe-is-it-possible-to-automatically-source-scripts-on-startup&usg=ALkJrhjhWvWAQ4F6xEeJmgnn1SRWf8D5gAKnowing when all threads terminate and deal with exceptions - javaLua bindings: table vs userdata - lua-tableIs there a good Flex (3) date and time picker? - flexOpen / Close NHibernate Session - c #Determine which process / program starts my process / program - c ++How to run ASP.NET MVC 1 and 2 on the same computer? - asp.net-mvcAll Articles