Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 327
SAN Avatar asked Mar 31 '12 17:03

SAN


People also ask

Is it possible for a web server to provide data to a web client without the client making request?

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.

Do servers send requests?

HTTP Basics As a quick summary, the HTTP/1.1 protocol works as follows: The client (usually a browser) opens a connection to the server and sends a request. The server processes the request, generates a response, and closes the connection if it finds a Connection: Close header.

Can server request data from client?

Servers only wait for requests from clients. Unless they also act as a client to other servers.

How does server push data to client?

Push technology or server push is a style of Internet-based communication where the request for a given transaction is initiated by the publisher or central server. It is contrasted with pull/get, where the request for the transmission of information is initiated by the receiver or client.


1 Answers

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.

like image 62
Declan Cook Avatar answered Oct 26 '22 20:10

Declan Cook