Tomcat update event
I am working on an application that uses tomcat as a web server and a java swing application. as soon as the client to communicate with the web server through the web service.
I am stuck in a situation where I need a server to somehow notify the client of some updated event that happened on the server side. Something like reverse ajax or similar.
Any ideas ...
Abdul Khalik
source to share
The most common approach would be your client to poll the server. This means periodically submitting requests to the server to request new events. This will result in a delay between the occurrence of the event and its notification to the client.
Another approach is to issue an HTTP request from the client and leave it open until an event occurs. Thus, notifications arrive immediately after the event. When an event is reported, you issue another request. This approach has the disadvantage that it greatly limits the number of clients that the server can server at any time. The default for Tomcat threads is 150. You need one thread for each HTTP request, so you cannot have more than 150 open requests.
source to share