main website home
  • About this blog

    This blog features updates, opinions, and technical notes from Caucho engineers about Caucho products, the enterprise Java industry, and PHP. Caucho Technology is the creator of the Resin Application Server and the Quercus PHP in Java engine. A leader in Java performance since 1998, Caucho is a Sun JavaEE licensee with over 9000 customers worldwide.
  • Tags

    ajaxworld bam candi cdi cloud cluster comet configuration deploy devoxx eclipse ejb embedded flash flex google app engine hessian hmtp ioc java ee 6 javaone javazone jms messaging newsletter nyjug osgi php pomegranate quercus resin resin 4.0 REST servlet sfjug silicon valley code camp spring testing training tssjs watchdog webbeans web profile websockets wordpress
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
« Friday Meeting Summary, Jan 16
Resin 4.0 jcache (distributed caching) »

HMTP - publish/subscribe packets

Resin cloud

With the rise of instant events like twitter and RSS, publish/subscribe technologies are finally getting the respect they deserve. With HMTP, a client can subscribe to a message stream and wait for messages to arrive, avoiding the need for polling. In fact, since HMTP is an addressable architecture, the client can subscribe to multiple publishing services at once, with a single connection and receive notifications as they happen, not waiting every 15 minutes.

To support publish/subscribe (and following the Jabber/XMPP specification), HMTP has 8 packets devoted to subscriptions and presence notifications:

  • presence - notify a service that a client has logged in
  • presenceProbe - query for client capabilities (text, html, mp3, etc.)
  • presenceUnavailable - notify that a client has logged out
  • presenceSubscribe - request for a new subscription
  • presenceSubscribed - successful subscription notification
  • presenceUnsubscribe - unsubscribe from a service
  • presenceUnsubscribe - notice of unsubscription
  • presenceError - error occurring during presence/subscription

presence

The presence packet notifies subscription services, or chat rooms, or IM buddies, that a user has logged on and is ready to receive messages.

presence ::=
            int      # type: code = 6
            string  # to: jid, e.g. "news@cnn.com"
            string  # from: jid, e.g. "ferg@hmtp.caucho.com"
            object  # value: Serializable payload, e.g. NewsLogin()

presenceUnavailable

The presence unavailable packet notifies subscription services, or chat rooms, or IM buddies, that a user has logged out and is no longer capable of receiving messages.

presenceUnavailable ::=
            int      # type: code = 7
            string  # to: jid, e.g. "news@cnn.com"
            string  # from: jid, e.g. "ferg@hmtp.caucho.com"
            object  # value: Serializable payload, e.g. NewsLogout()

presenceProbe

The presenceProbe lets a service query a client of its capabilities, like asking a news reader if it’s capable of handling .jpg images

presenceProbe ::=
            int      # type: code = 8
            string  # to: jid, e.g. "ferg@hmtp.caucho.com"
            string  # from: jid, e.g. "news@cnn.com"
            object  # value: Serializable payload, e.g. NewsCapabilities()

presenceSubscribe

The presenceSubscribe requests a subscription to a service.

presenceSubscribe ::=
            int      # type: code = 9
            string  # to: jid, e.g. "news@cnn.com"
            string  # from: jid, e.g. "ferg@hmtp.caucho.com"
            object  # value: Serializable payload, e.g. NewsSubscribe()

presenceSubscribed

The presenceSubscribed accepts a subscription to a service.

presenceSubscribed ::=
            int      # type: code = 10
            string  # to: jid, e.g. "ferg@hmtp.caucho.com"
            string  # from: jid, e.g. "news@cnn.com"
            object  # value: Serializable payload, e.g. NewsSubscribed()

presenceUnsubscribe

The presenceUnsubscribe tells a service to unsubscribe the client.

presenceUnsubscribe ::=
            int      # type: code = 11
            string  # to: jid, e.g. "news@cnn.com"
            string  # from: jid, e.g. "ferg@hmtp.caucho.com"
            object  # value: Serializable payload, e.g. NewsUnsubscribe()

presenceUnsubscribed

The presenceUnsubscribed tells a client that it’s been unsubscribed from a service.

presenceUnsubscribed ::=
            int      # type: code = 12
            string  # to: jid, e.g. "ferg@hmtp.caucho.com"
            string  # from: jid, e.g. "news@caucho.com"
            object  # value: Serializable payload, e.g. NewsUnsubscribed()

presenceError

The presenceError is a client error message.

presenceError ::=
            int      # type: code = 13
            string  # to: jid, e.g. "ferg@hmtp.caucho.com"
            string  # from: jid, e.g. "news@caucho.com"
            object  # value: Serializable payload, e.g. NewsSubscribe()
            object # error: BamError

Tags: bam, hmtp, pub/sub

This entry was posted on Tuesday, January 20th, 2009 at 11:25 am and is filed under Engineering. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.


Caucho Technology is proudly powered by WordPress and Quercus®
Entries (RSS) and Comments (RSS).

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • BLOG |
  • WIKI 4 |
  • WIKI 3 |
  • Resin: Java Application Server
Copyright (c) 1998-2012 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
resin® is a cloud optimized, java® application server that supports the java ee webprofile ®