开发者

autoupdate webpage [duplicate]

开发者 https://www.devze.com 2023-03-06 09:16 出处:网络
This question already has answers here: PHP : Best way to push data from server to clients.....? (3 answers)
This question already has answers here: PHP : Best way to push data from server to clients.....? (3 answers) Closed 3 years ago.

开发者_开发百科How to make an auto update page, like facebook, of twitter? There's one solution that I know. I can do that with ajax or jquery that send request to the server every t seconds. but, I think it's too risky, because if I have 1000 users access the pages, so the server will receive too many request from the users.

Is there any other way to do it?? thanks for your help..


Try this in the page where u want refresh page. Here i gave 10sec. i.e. after foreavh 10secs it'll refresh the page so it'll automatically loads that page at every 10secs so u do ur update in that

<script type="text/javascript">
document.write("<meta http-equiv='refresh' content='10' >");
</script>


The only way you can recieve information is by sending requests, if sending too many requests is a problem, then your stuck.

However, you don't have to do full page updates, why don't you just have auto refresh on important areas and do small individual requests for the areas you wish to update?


Try reading about Comet

Unfortunately there is no other method then request/wait/response.

Read some more about scalability just to be able to start your system on the right track.

However, just try to avoid premature optimisation and over engineering, so you will be able to be up and running in short time with your site

0

精彩评论

暂无评论...
验证码 换一张
取 消