Reverse Ajax + JSP Servlet

We are trying to create reverse ajax in our project.

I checked the network and did not find anything specific. I could not run any of the tutorials that were successfully provided.

My object: to provide on-screen alerts (for example, pop-ups) when there is ever even a click from the server (this could be a high level of processor utilization / ram, whatever).

+2
source share
2 answers

The HTTP protocol (fortunately in the end) does not support PUSH, so it stops there.

The best you can do is let the client run timer ajax polling requests, I can recommend jQuery.ajax() in combination with setInterval() for this.

Alternatively (and with a little more effort) you can use the Comet method (which simulates fictitious HTTP PUSH less or more). For more information, refer to the application documentation / wiki using this keyword. Here is an example of Tomcat: http://wiki.apache.org/tomcat/WhatIsComet

Edit: on request, here is the Tomcat + Comet tutorial to get started: http://www.ibm.com/developerworks/web/library/wa-cometjava/#N100CC Hope this helps.

+7
source

Here is a valuable resource

+1
source

Source: https://habr.com/ru/post/1335830/


All Articles