Paul Morrison
Paul Morrison

Reputation: 1724

Multiple replies from server for one client request

This may be a dumb question - and the title may need to be improved... I think my requirement is pretty simple: I want to send a request for data from a client to a server program, and the server (not the client) should respond with something like "Received your request - working on it". The client then does other work. Then when the server has obtained the data, it should send an asynchronous message (a popup?) saying "I've got your data; click on ... (presumably a URL) to obtain data". I have been assuming that the server could be written in Java and that client is html and JavaScript. I haven't been able to come up with a clean solution - help would be appreciated.

Upvotes: 0

Views: 375

Answers (5)

prabhakaran
prabhakaran

Reputation: 5274

Try to employ "Websocket Method" by using "SuperWebSocket" for server side, and "WebSocket4Net" for client side. It is working perfectly for my current project.

Upvotes: 1

gbjbaanb
gbjbaanb

Reputation: 52689

Nowadays you have an alternative technique to use: Websockets. These are used for server->client communication without polling or ajax-style delayed responses.

Upvotes: 0

Niko
Niko

Reputation: 6269

for pure java i suggest something like jgroups (client+server are java) for html, you should use ajax - there you have a timer that checks every X seconds

Upvotes: 0

Thom Smith
Thom Smith

Reputation: 14086

Are you trying to do this on the HTTP protocol? It sounds like you're talking about a web application here, but it's not clear from the question. If so, then there are a variety of techniques for accomplishing this using AJAX which collectively go under the name "Comet". Depending on exactly what you're trying to accomplish, a number of different implementation, on both the client and server side, may be appropriate.

Upvotes: 0

Zoidberg
Zoidberg

Reputation: 10333

Most of the work invovles the server being asynchronous. To do this you must

  1. Have an ajax call to the server that starts a job and returns a confirmation the job has been started.
  2. A page on the server that will return whether or not any jobs are complete for a user.
  3. Have an ajax widget on your client side that pings that page on teh server every so often to see if any jobs have been completed. And if so make a pop up.

This is the only way unless you use Flex data services.

Upvotes: 1

Related Questions