Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unsolicited Responses

 
Doug Gschwind
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
paul wheaton
Trailboss
Pie
Posts: 21484
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
g2 bhai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic