最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - can web server send data without a request from client? - Stack Overflow

programmeradmin5浏览0评论

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

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

Share Improve this question asked Mar 31, 2012 at 17:41 SANSAN 2,2474 gold badges26 silver badges33 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 11

You can use web-sockets which are two way munication 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.

Try reverse AJAX call using DWR!

check this click for demo and source

发布评论

评论列表(0)

  1. 暂无评论