HMTP - publish/subscribe packets

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
