Rewrite the pubsub.js example using the messaging api