ajax - Does CometD (Comet with Bayeux Protocol) use HTTP streaming or HTTP long polling? -


there 2 techniques implementing comet. 1 uses http streaming, uses single persisted tcp connection send , receive multiple http requests/responses between client/server.the second http long polling, keeps connection open server, and, event occurs, response committed , connection closed. then, new long-polling connection reopened client waiting new events arrive.

i using faye ruby gem , noticed uses comet/bayeux out of box. cannot find out type of comet technique uses. gather bayeux publish-subscribe protocol. i'm curious know if suffers same shortcomings of http streaming , long polling. allow full-duplex communication (communication in both directions, and, unlike half-duplex, allows happen simultaneously.)?

your definition of http streaming , long-polling not correct.

in http streaming, client sends request server, , server replies "infinite" response contains small chunks of data (messages), typically using chunked transfer encoding. mechanism has been standardized eventsource (a.k.a server-sent events). server-to-client push of events. client send message server, has open new connection.

in http long-polling, client sends request held server until event (or timeout) occurs, response committed connection not closed. connection kept open , other requests may sent on connection, both normal or long-polling requests (one @ time, of course).

the bayeux protocol application protocol on top of transport protocol such http or websocket.

http full duplex protocol in context of single request/response exchange. multiple http exchanges serialized (that is, executed 1 after other). http request/response exchange unit of serialization.

websocket full duplex protocol in context of websocket messages. websocket messages may sent , received simultaneously. websocket message unit of serialization.

bayeux inherits characteristics of transport protocol carried on. bayeux protocol not have "duplexness" characteristics, can think of way format messages in particular textual form.

both cometd , faye use bayeux on both websocket , http long-polling.


Comments