SAN
SAN

Reputation: 2247

can web server send data without a request from client?

I have a tool which takes any time from a minute to couple of hours. I want to write a web application to enable users to run the tool from webpage. Since each tool run takes longer time, i want to send the tool run request from the webpage, then i want to update the page with status information. For updating the status information, the client has to poll the server. Is there any way by which server can send the status message to the client without a request

Upvotes: 12

Views: 16959

Answers (2)

Declan Cook
Declan Cook

Reputation: 6126

You can use web-sockets which are two way communication between client and server that remain open and allow the server to send without request from the client. However web-sockets are new and browser support is only for the most current browsers.

socket.io is a great library for web sockets with fall backs to AJAX and flash if they are not supported.

Other than that the only other way for the server to send data to the clients is after the client has sent a request. There is methods using AJAX polling from the client to check for updates from the server.

Upvotes: 11

Ramesh Kotha
Ramesh Kotha

Reputation: 8322

Try reverse AJAX call using DWR!

check this click for demo and source

Upvotes: 0

Related Questions