comet vs pubsub..?
Asked Answered
B

2

8

may i know what is the different between these 2 approach ? can explain in lay man terms?

Bridoon answered 1/9, 2009 at 13:9 Comment(1)
As DLauer says, there is no difference really - you can't compare them they are 2 completely different things. Comet is long-lived HTTP connections. Pub/sub is a way of modelling interest in topics - in middleware, MQ, Comet or whatever...Dispirited
G
6

Comet is a technology for pushing real-time data to a web browser - so the page can continually update. For more details see this page about Comet.

Pub/Sub (or Publish/Subscribe) is not different to Comet, it is a way of telling a Comet server what data you want to receive (Subscribe) and sending data to other subscribers (Publish). Many Comet servers implement the pub/sub model.

Real world examples in StreamHub Comet Server:

Subscribe: I want to receive news about Google:

hub.subscribe("/news/google", function(sTopic, oData) { alert("Received news article about Google: " + oData.Article});

Publish: I want to contribute some news about Google:

hub.publish("/news/google", "{'Title':'Google Expanding Access To Wave Soon, First Impressions','Article':'According to Google, included in this group of early testers will be some of the businesses using Google Apps. In anticipation of this wider release, ...'}");

Anyone subscribed to the topic "/news/google" will receive the article I published above - that's how pub/sub works.

Gilboa answered 1/9, 2009 at 23:53 Comment(0)
A
4

Publish-subscribe is a means of asynchronous communication that decouples publishers from subscribers. Rather than addressing messages to particular subscribers, publishers publish messages on a topic. Subscribers subscribe to the topic. A given topic can have many publishers and many subscribers.

For example, in a trading system, trades of Google shares might be published on a topic of "Trade.GOOG". Subscribers could then listen to trades in particular stocks by listening to the requisite topics.

Comet is a Web-based technique for server-push using long-lived HTTP connections.

Imagine a Poker website. Your browser could make a connection to the server, which would essentially hang until it was your turn to do something (raise, call, etc) rather than you hitting refresh every few seconds to see if you need to do something. Polling is another solution to this.

The similarity they both have is that they are essentially a means of asynchronous communication but otherwise are dissimilar.

Archaeology answered 1/9, 2009 at 13:12 Comment(3)
i understand about comet that you explained. but on your pubsub... in lay man terms. pleaseBridoon
Publish-Subscribe would be the real-world equivalent of a magazine. You subrscribe to it, and receive it when they publish. The magazine isn't just for you...it's for every subscriber.Pavlov
does that mean, it's better than using comet ?Bridoon

© 2022 - 2024 — McMap. All rights reserved.