Comet (programming): Difference between revisions

Content deleted Content added
Monkbot (talk | contribs)
m Task 18 (cosmetic): eval 24 templates: hyphenate params (20×);
Bender the Bot (talk | contribs)
m Alternatives: HTTP to HTTPS for Blogspot
 
(23 intermediate revisions by 17 users not shown)
Line 1:
{{short description|Web application model}}
'''Comet''' is a [[web application]] model in which a long-held [[HTTPS]] request allows a [[web server]] to [[Push technology|push]] data to a [[web browser|browser]], without the browser explicitly requesting it.<ref name='"MASH'">{{cite web | url = http://www.infoworld.com/d/developer-world/ajax-alliance-recognizes-mashups-559 | title = AJAX alliance recognizes mashups | access-date = 2010-10-20 | last = Krill | first = Paul | date = September 24, 2007 | publisher = [[InfoWorld]]}}</ref><ref name="CRANG">{{cite book|title=Comet and Reverse Ajax: The Next-Generation Ajax 2.0|last2=McCarthy|first2=Phil|date=October 13, 2008|publisher=[[Apress]]|isbn=978-1-59059-998-3|last1=Crane|first1=Dave}}<!--| accessdate = 2010-10-20 --></ref> ''Comet'' is an [[umbrella term]], encompassing multiple techniques for achieving this interaction. All these methods rely on features included by default in browsers, such as [[JavaScript]], rather than on non-default plugins. The Comet approach differs from the [[World Wide Web#How the Web worksFunction|original model of the web]], in which a browser requests a complete web page at a time.<ref name = "WRC" />
 
The use of Comet techniques in [[web development]] predates the use of the word ''Comet'' as a [[neologism]] for the collective techniques. Comet is known by several other names, including
Line 23 ⟶ 24:
|author2=McCarthy, Phil
|publisher = Apress
|isbn = 978-1-59059-998-53
|date=July 2008
}}</ref> ''Two-way-web'',<ref name="ajax-dp-oreilly"/> ''HTTP Streaming'',<ref name="ajax-dp-oreilly">{{cite book
Line 34 ⟶ 35:
|pages=[https://archive.org/details/ajaxdesignpatter00mahe/page/19 19; 85]
|chapter=Web Remoting
|chapter-url-access=registration
|chapter-url=https://archive.org/details/ajaxdesignpatter00mahe/page/19
}}</ref> and
''[[HTTP push|HTTP server push]]''<ref>{{cite web
Line 59 ⟶ 60:
|archive-date = 2006-02-08
}}
</ref> The term ''Comet'' is not an acronym, but was coined by Alex Russell in his 2006 [[blog]] post ''Comet: Low Latency Data for the Browser''.<ref>{{cite web
|url = http://infrequently.org/2006/03/comet-low-latency-data-for-the-browser/
|title = Comet: Low Latency Data for the Browser
Line 66 ⟶ 67:
|date = 2006-03-04
|access-date = 2014-11-02
}}</ref>{{citation needed|date=June 2023}}
}}
</ref>
 
In recent years{{When|date=January 2025}}, the standardisation and widespread support of [[WebSocket]] and [[Server-sent events]] has rendered the Comet model obsolete.
 
==History==
Line 86:
| publisher = Northeast Parallel Architecture Center, College of Engineering and Computer Science
| access-date = 27 February 2016
}}</ref>{{failed verification|date=December 2017}} implemented in 1996–98 at the Northeast Parallel Architectures Center ([http://surface.syr.edu/npac/ NPAC]) at [[Syracuse University]] using [[DARPA]] funding. TANGO architecture has been patented by Syracuse University.<ref>{{Citation|lastlast1 = Podgorny|firstfirst1 = Marek|title = United States Patent: 6078948 - Platform-independent collaboration backbone and framework for forming virtual communities having virtual rooms with collaborative sessions|date = June 20, 2000|url = http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%252Fnetahtml%252FPTO%252Fsearch-bool.html&r=14&f=G&l=50&co1=AND&d=PTXT&s1=Podgorny.INNM.&OS=IN/Podgorny&RS=IN/Podgorny|last2 = Beca|last3 = Cheng|last4 = Fox|last5 = Jurga|last6 = Olszewski|last7 = Sokolowski|last8 = Walczak|last9 = PL|first2 = Lukasz|first3 = Gang|first4 = Geoffrey C.|first5 = Tomasz|first6 = Konrad|first7 = Piotr|first8 = Krzysztof|access-date = 2016-02-27|archive-date = 2017-05-09|archive-url = https://web.archive.org/web/20170509022914/http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%252Fnetahtml%252FPTO%252Fsearch-bool.html&r=14&f=G&l=50&co1=AND&d=PTXT&s1=Podgorny.INNM.&OS=IN/Podgorny&RS=IN/Podgorny|url-status = dead}}</ref> TANGO framework has been extensively used as a distance education tool.<ref>{{Cite web
| url = https://www.dsc.soic.indiana.edu/sites/default/files/tr_9921.pdf
| title = Experiences with Using TANGO Interactive in a Distributed Workshop
Line 95:
| publisher = CEWES MSRC/PET TR/99-21
| access-date = 27 February 2016
| archive-date = 8 March 2021
}}</ref> The framework has been commercialized by [http://www.collabworx.com CollabWorx] and used in a dozen or so Command&Control and Training applications in the United States Department of Defense{{fact|date=December 2017}}.
| archive-url = https://web.archive.org/web/20210308093626/https://www.dsc.soic.indiana.edu/sites/default/files/tr_9921.pdf
| url-status = dead
}}</ref> The framework has been commercialized by [http://www.collabworx.com CollabWorx] and used in a dozen or so Command&Control and Training applications in the United States Department of Defense{{factcitation needed|date=December 2017}}.
 
===First Comet applications===
The first set of Comet implementations datedates back to 2000,<ref name="CometDaily_History">{{cite web |url=http://cometdaily.com/2007/10/19/comet-and-push-technology/ |title=CometDaily: Comet and Push Technology |access-date=2007-12-15 |archive-url=https://web.archive.org/web/20071113174053/http://cometdaily.com/2007/10/19/comet-and-push-technology/ |archive-date=2007-11-13 |url-status=dead }}</ref>{{unreliable source?|date=November 2017}} with the [[Pushlets]], [[Lightstreamer]], and KnowNow projects. [[Pushlets]], a framework created by Just van den Broecke, was one of the first<ref name="pushlets-javaworld">Just van den Broecke (1 March 2000). “[http://www.javaworld.com/article/2076063/java-web-development/pushlets--send-events-from-servlets-to-dhtml-client-browsers.html Pushlets: Send events from servlets to DHTML client browsers] {{Webarchive|url=https://web.archive.org/web/20140804175811/http://www.javaworld.com/article/2076063/java-web-development/pushlets--send-events-from-servlets-to-dhtml-client-browsers.html |date=2014-08-04 }}”. JavaWorld. Retrieved 1 August 2014.</ref> open source implementations. Pushlets were based on server-side Java servlets, and a client-side JavaScript library. Bang Networks{{snd}} a [[Silicon Valley]] start-up backed by [[Netscape]] co-founder [[Marc Andreessen]]{{snd}} had a lavishly- financed attempt to create a real-time push standard for the entire web.<ref>{{cite web
|url=http://news.cnet.com/2100-1023-255088.html
|title=Will the "refresh" button become obsolete?
Line 123 ⟶ 126:
 
==Implementations==
Comet applications attempt to eliminate the limitations of the [[World Wide Web#How the Web worksFunction|page-by-page web model]] and traditional [[polling (computer science)|polling]] by offering two-way sustained interaction, using a persistent or long-lasting HTTP connection between the server and the client. Since browsers and proxies are not designed with server events in mind, several techniques to achieve this have been developed, each with different benefits and drawbacks. The biggest hurdle is the [[Hypertext Transfer Protocol|HTTP]] 1.1 specification, which states "this specification... encourages clients to be conservative when opening multiple connections".<ref>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing, [http://tools.ietf.org/html/rfc7230#section-6.4 section 6.4]. IETF. Retrieved 2014-07-29</ref> Therefore, holding one connection open for real-time events has a negative impact on browser usability: the browser may be blocked from sending a new request while waiting for the results of a previous request, e.g., a series of images. This can be worked around by creating a distinct [[hostname]] for real-time information, which is an alias for the same physical server. This strategy is an application of ___domain sharding.
 
Specific methods of implementing Comet fall into two major categories: streaming and [[long polling]].
Line 133 ⟶ 136:
 
====Hidden iframe====
A basic technique for dynamic web application is to use a hidden [[HTML element#Frames|iframe]] HTML element (an ''inline frame'', which allows a website to embed one HTML document inside another). This invisible iframe is sent as a [[Chunked transfer encoding|chunked]] block, which implicitly declares it as infinitely long (sometimes called "forever frame"). As events occur, the iframe is gradually filled with <code>script</code> tags, containing JavaScript to be executed in the browser. Because browsers render HTML pages incrementally, each <code>script</code> tag is executed as it is received. Some browsers require a specific minimum document size before parsing and execution is started, which can be obtained by initially sending 1–2 kB of padding spaces.<ref name="ajaxoreilly">{{cite book
| last = Holdener III
| first = Anthony T.
Line 139 ⟶ 142:
| publisher = [[O'Reilly Media]]
|date=January 2008
| isbn = 978-0-596-52838-86
| chapter = Page Layout with Frames that Aren't
| page = 320
Line 164 ⟶ 167:
|url=https://archive.org/details/javascript00libg_297
|url-access=registration
|series=The Definitive Guide
|date=2006-08-17
|publisher=[[O'Reilly Media]]
Line 179 ⟶ 181:
Browser-native technologies are inherent in the term Comet. Attempts to improve non-polling HTTP communication have come from multiple sides:
 
* The [[HTML 5]] draft specification produced by the [[Web Hypertext Application Technology Working Group]] (WHATWG) specifies so called [[server-sent events]],<ref name='"server-sent-events'">{{cite web|editor=Ian Hickson |date=2007-10-27 |work=HTML 5 - Call For Comments|title=6.2 Server-sent DOM events|url=http://www.whatwg.org/specs/web-apps/2007-10-26/multipage/section-server-sent-events.html#server-sent-events |publisher=[[WHATWG]]|access-date=2008-10-07}}</ref> which defines a new JavaScript interface <code>EventSource</code> and a new MIME type <code>text/event-stream</code>. [[Server-sent_events#Web_browsers|All major browsers except Microsoft Internet Explorer]] include this technology.
* The [[HTML 5]] [[WebSocket]] API working draft specifies a method for creating a persistent connection with a server and receiving messages via an <code>onmessage</code> callback.<ref>
{{cite web
|url=http://www.w3.org/TR/websockets/
Line 192 ⟶ 194:
</ref>
* The Bayeux protocol by the [[Dojo Foundation]]. It leaves browser-specific transports in place, and defines a higher-level protocol for communication between browser and server, with the aim of allowing re-use of [[client-side JavaScript]] code with multiple Comet servers, and allowing the same Comet server to communicate with multiple client-side JavaScript implementations. Bayeux is based on a publish/subscribe model, so servers supporting Bayeux have publish/subscribe built-in.<ref name="bayeux">{{cite web|author=Alex Russell |year=2007 |url=http://svn.cometd.org/trunk/bayeux/bayeux.html|title=Bayeux Protocol - Bayeux 1.0draft1.| publisher= Dojo Foundation| access-date=2007-12-14|display-authors=etal}}</ref>
* The [[BOSH (protocol)|BOSH]] protocol by the XMPP standards foundation. It emulates a bidirectional stream between the browser and server by using two synchronous HTTP connections.
* The JSONRequest object, proposed by [[Douglas Crockford]], would be an alternative to the XHR object.<ref>{{cite web
|url=http://www.json.org/JSONRequest.html
Line 203 ⟶ 205:
}}</ref>
* Use of plugins, such as [[Java applet]]s or the proprietary [[Adobe Flash]] (using [[Real-Time Messaging Protocol|RTMP]] protocol for data streaming to Flash applications). These have the advantage of working identically across all browsers with the appropriate plugin installed and need not rely on HTTP connections, but the disadvantage of requiring the plugin to be installed
* [[Google]] announced<ref>App, The. (2010-12-02) [httphttps://googleappengine.blogspot.com/2010/12/happy-holidays-from-app-engine-team-140.html Google App Engine Blog: Happy Holidays from the App Engine team - 1.4.0 SDK released]. Googleappengine.blogspot.com. Retrieved on 2014-04-12.</ref> a new Channel API for [[Google App Engine]],<ref>Paul, Ryan. (2010-12-06) [https://arstechnica.com/web/news/2010/12/app-engine-gets-streaming-api-and-longer-background-tasks.ars App Engine gets Streaming API and longer background tasks]. Ars Technica. Retrieved on 2014-04-12.</ref> implementing a Comet-like API with the help of a client JavaScript library on the browser. This API has been deprecated. <ref>{{cite web |url=https://cloud.google.com/appengine/docs/standard/java/javadoc/com/google/appengine/api/channel/package-summary |title=Package com.google.appengine.api.channel |publisher=[[Google]] |date=2019-11-16 |access-date=2020-04-30 |quote=This API has been deprecated. }}</ref>
 
==See also==
* [[Push technology]]
* [[Pull technology]]
 
== Notes ==
{{notelist}}
 
==References==
Line 213 ⟶ 218:
 
==External links==
* [{{cite web |title=Comet Daily |url=http://cometdaily.com/ |archive-url=https://web.archive.org/web/20080104091304/http://cometdaily.com/ |archive-date=2008-01-04 |url-status=dead |quote=Comet Daily] provides ainformation website dedicated to articles onabout Comet techniques. |access-date=2007-11-29 }}*
* [https://web.archive.org/web/20080330033520/http://cometdaily.com/maturity.html Comparison of several comet server implementations]
 
{{DEFAULTSORT:Comet (Programming)}}