An Introduction to PubSub

by Dylan SchiemannOctober 21st, 2007

For anyone new to Comet, PubSub (short for “publish and subscribe”) may be a new concept. KnowNow, mod_pubsub, Cometd, and others use this concept as an easy mechanism to conceptualize the routing of events through topics, and the Dojo Toolkit also uses this concept in its dojo.topic API.

In very simple terms, the idea is that when something of interest happens, a publisher may broadcast a message on a particular topic. When that happens, all subscribers that are registered to listen to that topic are notified with a copy of that message. Here’s a very simple code fragment that shows this in action with Cometd:

dojox.cometd.subscribe("/the/channel", object, "function");

dojox.cometd.publish("/the/channel", {object: "JSON encoded data"});

One Response to “An Introduction to PubSub”

  1. Comet Daily » Blog Archive » PubSub and Topics Says:

    [...] of interest occurs through registering a handle to a topic. The simple example that I used in my introduction to PubSub explains this concept more [...]


Copyright 2015 Comet Daily, LLC. All Rights Reserved