如何使用长轮询或阿贾克斯推入你的网站 [英] How to Use Long Polling or Ajax Push in your Website

查看:229
本文介绍了如何使用长轮询或阿贾克斯推入你的网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用Ajax推。我已经从阿贾克斯推可以通过使用像彗星,APE(AJAX的推动引擎)等几个节目来获得各种Web文章了解到....但我想知道是否有使用它的一个简单的方法,并用什么语言实现Ajax推。因为在我所见过的文章。他们使用的是Java。我没有学过:(所以我想知道是否有这样的:?在您的服务器一个JavaScript其中设置一个间隔一个特定的项目,然后如果发现任何更改,然后使用PHP的echo出来请大家帮我出。本公司是一个星期,现在我试图做到这一点,我试图通过使用间隔,但没能得到结果正常使用AJAX和PHP谢谢PS:请告诉我使用它的一个例子的简单方法或什么的。

I want to know how to use ajax push . i have learnt from various Web articles that Ajax push can be obtained by using few programmes like COMET, APE (AJAX PUSH ENGINE) etc.... But i want to know whether there is a simpler way of using it and what language is used to implement ajax push. because in the articles which i have seen. they are using java. which i did not learn :( so i would like to know whether there is something like : a javascript in your server which sets an interval to a particular item and then if any changes found then echo it out using php. ? please help me out for this . its been a week now i tried to achieve this. i tried to use normal ajax and php by using intervals but not able to get the result. Thank you. P.S : Please show me an easy way of using it with an example or something.

推荐答案

我使用了基于闪存前段时间一个非常简单的方法

I used a very simple approach based on flash some time ago

我加入了一个小1px的1px的*透明在我的网页,打开插座给我的AJAX请求发送到服务器闪存。服务器接收AJAX请求和响应闪光灯插座

I included a little 1px*1px transparent flash on my page that opened a socket to the server my AJAX sends requests to. The server receives the AJAX request and responds on the flash socket

闪光灯只是打开一个javascript:URL调用一个的onReceive事件处理程序,这样你就不会打开新的一页,但在当前网页上运行的JavaScript

The flash just opens a javascript: url that calls an onreceive event handler, so you won't open a new page but run the javascript on your current page

这篇关于如何使用长轮询或阿贾克斯推入你的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆