This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Suppose you have a web browser/applet running which you would like to receive unsolicited messages from the server side. e.g. Suppose the client side wishes to subscribe for and display event data when certain events are posted to an OMG CORBAservice Event Service implementation. It does not appear that Servlets support this functional need very well due to the request-response paradigm. I did however read about a couple of tricks which may or may not in fact help in this regard. One involves the use of a persistent connection. The other could be that the client side issues one request, where the servlet responds multiple times, but never actually closes the response object. What do you know about these two mechanisms? What technological alternatives provide a more "intended" solution to this problem?
I don't see a servlet helping here. I do see a socket connection from the applet to a server program (not a servlet). Over this full time connection, the server will send the occasional message. This seems the most straightforward.
I agree with Paul here. One of the main things about the Applet specification is that despite all the sandbox limitations, applets are always allowed to make a socket connection to the originating host. It's a bit of a shame, but many applet writers inore this and try to make HTTP jump through hoops. Don't be afraid of writing a server, either. There are plenty of examples around, and a simple server needn't be more than 50 lines of code.
Hi Since the solution is to have an Applet to use for communication between the Server and the client.Can i have an invisible Applet..which will run in the background and only show messages to the client when the Server when the server wants the applet to display the messages. thanks g2
Correct. Http doesn't allow for "volunteering" info. However, an applet can poll the server and get the same net effect, subject to the polling overhead. To do a true "listen" (non-polled operation), you'd need to use a non-http I/O port, which could run you into the firewall.
Customer surveys are for companies who didn't pay proper attention to begin with.