然而,长轮询也有其自己的局限性。
另一个常见的技巧是长轮询。
有两种基本的轮询管道:短轮询与长轮询。
There are two basic types of polling channels, short and long polling.
这样就实现了长轮询。
长轮询是用于更新服务器数据的另外一种方法。
Long poll is another approach that is used to update server data.
长轮询是一种优化传统轮询来降低延迟的技术。
Long polling is a technique that optimizes traditional polling to reduce latency.
该代码只是在用户单击Go按钮时开始长轮询。
This code simply starts the long poll when the user clicks the Go button.
至此,您可能会想,长轮询和流都有一个很大的问题。
At this point you might be thinking that there is a major problem with both long polling and streaming.
该技术的另一种方案就是长轮询,可以避免这两个问题。
An alternative to this technique is long polling, which can avoid both these problems.
Bayeux实现支持一种名为长轮询的特定HTTP方法。
Bayeux implementations support a specific HTTP method called long polling.
在长轮询请求中,客户机向服务器发出一个请求来检索可用信息。
In a long polling request, a client sends a request to a server to retrieve available information.
轮询与长轮询之间的主要区别在于服务器花多长的时间作出响应。
The main difference between polling and long polling is how long it takes the server to respond.
对于长轮询,客户机以与传统轮询类似的方法向服务器请求信息。
With long polling, the client requests information from the server in a manner that is similar to traditional polling.
BlazeDS项目将包括传统的轮询通道和长轮询通道来接收消息。
The BlazeDS project will include the traditional polling and long polling channels for retrieving messages.
例如,可以指定rtmp管道,但如果该连接失败,就回到长轮询管道。
For example an RTMP channel could be specified, but if that connection fails it could fail back to a long polling channel.
这也是为什么大多数遗留Comet解决方案简单的使用长轮询的原因。
This is why most legacy Comet solutions simply use long-polling.
长轮询相对于一般轮询的优点在于,数据一旦可用,便立即从服务器发送到客户机。
The advantage of a long poll over normal polling is that data goes from the server to the client as soon as it is available.
长轮询通常将连接保持一段较长的时间—通常是数秒钟,但是也可能是一分钟甚至更长。
A long poll generally keeps the connection open for a long time-usually several seconds, but it could be a minute or longer.
因为不存在Comet的标准,让我们区别来看两种不同类型的Comet实现:长轮询与流式查询。
Since there is no Comet standard as such, let's distinguish between two types of Comet implementations: long-polling and streaming.
流通道(streamingchannel)与长轮询大致相同,差别在于服务器不会关闭响应流。
Streaming channel is almost the same as long poll; the difference being that the server does not close the response stream.
setClientPollInterval指出两个Bayeux请求的间隔,在长轮询中通常设置为0。
SetClientPollInterval indicates the interval between the two Bayeux requests. This is usually set to zero in long polling.
长轮询是一种轮询技术,其中服务器延迟完成HTTP请求,直至已经为客户机准备好了一个更新信息或发生超时。
Long polling is a polling technique in which the server will delay completing the HTTP response until either an update is ready for the client or a timeout occurs.
所有服务端和客户端实现必须支持“长轮询”连接类型,并且应该支持“回调轮询”。其他连接类型都是可选的。
All server and client implementations MUST support the "long-polling" connection type and SHOULD support "callback-polling". All other connection types are OPTIONAL.
第二个模型称为长轮询:本文将讨论这一轮询模型—因为它以最快的速度响应服务器上的事件—以及一些需要克服的困难。
The second model is called a long poll: this article discusses this polling model-because it allows the quickest response to events on the server-as well as some hurdles to overcome.
这意味着可以给常规的请求设置很短的生命周期,但是对于响应长轮询请求的机制,也可以将这个生命周期延长至几分钟。
This means you can give regular requests a short lifetime, but you can also extend this lifetime to several minutes for a mechanism that responds to long polling requests.
一些Ajax请求必须立即处理,其他Ajax请求应该作为长轮询处理,普通的请求应该发布到WorkerQueue。
Some of the Ajax requests must be handled instantly, other Ajax requests should be handled as long polls, and normal requests should be posted on the WorkerQueue.
然而,在长轮询中,一个客户机可能需要随时向服务器发送一个重要请求,因此,服务器再一次需要为每个客户机准备一个或多个线程。
In long polling, however, a client would have an outstanding request to the server at any point of time.
简而言之,这个信道封装了两个flash.net.URLStream实例(指令和通道),并支持长轮询(long - polling)传输。
In short, this channel encapsulates two flash.net.URLStream instances (command and tunnel) and supports long-polling transport.
Bayeux和WebSockets都试图避免资源限制问题,使用回退机制来实现长轮询(比如Bayeux),或者切换到其他非http协议之上。
Both Bayeux and WebSockets attempt to avoid the resource limits by using a fall-back mechanism for long polling (in the case of Bayeux) or switching to a non-HTTP based secondary protocol instead.
客户端可以创建主题,并通过RESTful的API向它们提交消息,而其它客户端会通过HTTP的长轮询机制(long polling)来订阅多种主题。
The clients can create topics and submit messages to them through a RESTful API, while other clients subscribe to multiple topics through HTTP long polling.
应用推荐