XMPP::PEPNotifications
PEPNotifications is a high-level client for XEP-0223 - PEP Notifications.
PEP notifications carry an event payload on a subscribed node. When the subscriber also subscribes to the publisher's presence, the notification is delivered inside the presence stanza (as a <x xmlns='...pubsub#event'> extension); otherwise it arrives as a message carrying Stanza::PubSubEvent. This wrapper normalizes both delivery channels into the shared PubSubEvent model.
client.on("message") do |s, p| event = XMPP::PEPNotifications.from_message(p.as(XMPP::Stanza::Message)) end
client.on("presence") do |s, p| event = XMPP::PEPNotifications.from_presence(p.as(XMPP::Stanza::Presence)) end
See: https://xmpp.org/extensions/xep-0223.html
Class methods
from_message extracts the pubsub#event payload from a message, or nil.
from_presence extracts the pubsub#event payload carried by a presence stanza (XEP-0223 ยง5), or nil.
from_stanza accepts either a message or presence stanza and returns its pubsub#event payload, or nil when neither carries one.